当前位置: 代码迷 >> ASP.NET >> 在GridView中<ItemTemplate>里添加一个Button,点击Button后输出当前主键?解决方法
  详细解决方案

在GridView中<ItemTemplate>里添加一个Button,点击Button后输出当前主键?解决方法

热度:6294   发布时间:2013-02-25 00:00:00.0
在GridView中<ItemTemplate>里添加一个Button,点击Button后输出当前主键?
GridView绑定数据库后.DataKeyField属性是 "id "字段.
在 <ItemTemplate> 里添加一个Button,我想实现点击这个Button后输出当前选择的主键?要怎么实现啊?

谢谢.



------解决方案--------------------------------------------------------
<asp:Button CommandName= "a " CommandArgument= ' <%#Eval( "id "%> '在GridView的itemcommand事件中if(e.CommandName == "a "){ Response.Write(e.CommandArgument)}
  相关解决方案