asp.net怎样添加GridView的RowCommand事件
答案:1 悬赏:0 手机版
解决时间 2021-02-20 04:03
- 提问者网友:謫仙
- 2021-02-20 00:30
不会是直接写的吧?我直接再代码中写了整个事件,好像没用啊...希望哪位大侠帮帮我
最佳答案
- 五星知识达人网友:平生事
- 2021-02-20 01:55
第一种方法:
选中GridView控件,然后选中属性工具中的时间按钮(图标是一个闪电),然后找到RowCommand
,然后双击,自动生成了RowCommand事件。
第二种方法:
在源代码视图中
<asp:GridView ID="GridView1" runat="server" OnRowCommand="GridView1_RowCommand">
</asp:GridView>
这句话:OnRowCommand="GridView1_RowCommand" 是添加OnRowCommand事件
然后在你的逻辑代码中写入
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
//这里为你要写的代码
}
选中GridView控件,然后选中属性工具中的时间按钮(图标是一个闪电),然后找到RowCommand
,然后双击,自动生成了RowCommand事件。
第二种方法:
在源代码视图中
<asp:GridView ID="GridView1" runat="server" OnRowCommand="GridView1_RowCommand">
</asp:GridView>
这句话:OnRowCommand="GridView1_RowCommand" 是添加OnRowCommand事件
然后在你的逻辑代码中写入
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
//这里为你要写的代码
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯