添加onclick事件在asp.net指挥现场 [英] Add onclick event to command field in asp.net

查看:111
本文介绍了添加onclick事件在asp.net指挥现场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在DetailsView控件此更新的链接。

I have this update link in DetailsView.

<asp:CommandField ShowEditButton="true" ShowCancelButton="false" ValidationGroup="VAL_1" />

当我点击这个链接,它的更新页面上的内容。但我想更新页面上的内容,并重定向到另一个页面:点击此之后(前abc.aspx)

When i click this link, its updates the content on the page. but i want to updates the content on the page and redirect to another page (ex: abc.aspx) after click on this.

我怎么能这样做呢?

推荐答案

使用 ItemCommand 事件:

在code背后:

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

在ASPX:

<asp:DetailsView runat="server" 
     ID="detailsview1" 
     OnItemCommand="detailsview1_ItemCommand" ...

这篇关于添加onclick事件在asp.net指挥现场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆