前臺(tái)代碼:
<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>
后臺(tái)事件:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "edit") { Response.Write("Hello World"); } }
為什么在頁面上點(diǎn)擊按鈕時(shí),不會(huì)執(zhí)行RowCommand的代碼
在線等
- 3 回答
- 0 關(guān)注
- 603 瀏覽
添加回答
舉報(bào)
0/150
提交
取消