将onclick事件添加到asp.net中的命令字段

Bis*_*han 2 c# asp.net

我在DetailsView中有这个更新链接.

<asp:CommandField ShowEditButton="true" ShowCancelButton="false" ValidationGroup="VAL_1" />
Run Code Online (Sandbox Code Playgroud)

当我点击此链接时,它会更新页面上的内容.但我想更新页面上的内容并在点击此内容后重定向到另一个页面(例如:abc.aspx).

我怎么能这样做?

Ami*_*ach 5

使用ItemCommand活动:

代码背后:

protected void detailsview1_ItemCommand(Object sender, DetailsViewCommandEventArgs e)
{
    if (e.CommandName == "Update")
    {
        Response.Redirect("abc.aspx", false);
    }
}
Run Code Online (Sandbox Code Playgroud)

在aspx中:

<asp:DetailsView runat="server" 
     ID="detailsview1" 
     OnItemCommand="detailsview1_ItemCommand" ...
Run Code Online (Sandbox Code Playgroud)