当前位置: 代码迷 >> ASP.NET >> GridView中事件是怎么觸發的
  详细解决方案

GridView中事件是怎么觸發的

热度:9973   发布时间:2013-02-26 00:00:00.0
GridView中事件是如何觸發的?
GridView   中有個ImageButton,   查看網頁的源HTML怎麽沒有看到任何   __doPostBack   類似的代碼?

------解决方案--------------------------------------------------------
<input type= "image " .....>
这个自己有postback行为的
------解决方案--------------------------------------------------------
在GridView 中的控件
<asp:ImageButtonID= "ImageButton1 " runat= "server " CommandArgument= "1 " CommandName= "Del "> 删除 </asp:ImageButton>
事件:
protected void dgDepartmemt_ItemCommand(object source, DataGridCommandEventArgs e)
{
string departid = e.CommandArgument.ToString();
if (e.CommandName == "Del ")
{
//要写的代码
}
}
------解决方案--------------------------------------------------------
<input type= "image "> == <input type= "submit ">

如你Request[ "按扭名 "] 就会发现你只要点了哪个 哪个就会有值
  相关解决方案