前台代码:
<asp:GridView ID="GridView1" runat="server" OnRowCommand="GridView1_RowCommand " AutoGenerateColumns="false" AutoGenerateEditButton="false" > <Columns> <asp:BoundField HeaderText="ID" DataField="id" /> <asp:BoundField HeaderText="NAME" DataField="name" /> <asp:TemplateField HeaderText="Edit"> <ItemTemplate> <asp:ImageButton ID="dd" CommandName="eidt" CommandArgument="hello world" runat="server" ImageUrl="~/edith.bmp" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
后台事件:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "edit") { Response.Write("Hello World"); } }
为什么在页面上点击按钮时,不会执行RowCommand的代码
在线等
- 3 回答
- 0 关注
- 566 浏览
添加回答
举报
0/150
提交
取消