关于gridview里加按钮事件的总结
1.
onrowcommand="GridView1_RowCommand1"
在gridview申明时的属性里要有,然后找到闪电,双击
还有要把那个按钮行模板化,就是箭头里面的templed啥的,我懒得去看啦
2.在gridview包含<column>里的该命令行的要有
<asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:Button ID="Button2" runat="server" CausesValidation="false" CommandName="look" Text="查看" CommandArgument='<%#Eval("ep_id")%>' /> </ItemTemplate> </asp:TemplateField>
3.在这个事件里,加入
if (e.CommandName == "look") { Session["gridview1id"] = Convert.ToInt32(e.CommandArgument.ToString()); } else if (e.CommandName == "exam") { int id_in = Convert.ToInt32(e.CommandArgument.ToString()); }
就差不多啦