当前位置: 代码迷 >> ASP.NET >> 怎么区分gridview中的两个《选择》按钮
  详细解决方案

怎么区分gridview中的两个《选择》按钮

热度:1316   发布时间:2013-02-25 00:00:00.0
如何区分gridview中的两个《选择》按钮?
如何区分gridview中的两个《选择》按钮?
在gridview控件内定义了两个《选择》按钮:
<asp:CommandField SelectText="选择(修改)" ShowSelectButton="True" />
<asp:CommandField SelectText="选择(显示)" ShowSelectButton="True" />
在 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 事件中如何判断当前按下了哪一个《选择》按钮。



------解决方案--------------------------------------------------------
CommandName
------解决方案--------------------------------------------------------
楼上正解
------解决方案--------------------------------------------------------
CommandName=""
------解决方案--------------------------------------------------------
HTML code
<asp:CommandField SelectText="选择(修改)" CommandName="update" ShowSelectButton="True" /> <asp:CommandField SelectText="选择(显示)" CommandName="select" ShowSelectButton="True" />
------解决方案--------------------------------------------------------
up!
------解决方案--------------------------------------------------------
探讨
HTML code<asp:CommandField SelectText="选择(修改)" CommandName="update" ShowSelectButton="True" />
<asp:CommandField SelectText="选择(显示)" CommandName="select" ShowSelectButton="True" />



在OnRowCommand事件中


C# code if (e.CommandName == "update")
{
//业务代码
}
else if(e.CommandName == "select")
{
//业务代码
}

------解决方案--------------------------------------------------------
探讨
HTML code<asp:CommandField SelectText="选择(修改)" CommandName="update" ShowSelectButton="True" />
<asp:CommandField SelectText="选择(显示)" CommandName="select" ShowSelectButton="True" />



在OnRowCommand事件中


C# code if (e.CommandName == "update")
{
//业务代码
}
else if(e.CommandName == "select")
{
//业务代码
}

------解决方案--------------------------------------------------------
探讨
HTML code<asp:CommandField SelectText="选择(修改)" CommandName="update" ShowSelectButton="True" />
<asp:CommandField SelectText="选择(显示)" CommandName="select" ShowSelectButton="True" />



在OnRowCommand事件中


C# code if (e.CommandName == "update")
{
//业务代码
}
else if(e.CommandName == "select")
{
//业务代码
}
  相关解决方案