<asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%#Eval("ID") %>'>生成JS代码</asp:LinkButton> 
这是我自己在gridview里面定义的一个里linkbutton控件,请问怎么给他加后台事件,就是当点击他的时候执行后台代码
怎么做啊?

解决方案 »

  1.   

    <asp:LinkButton ID="LinkButton1" runat="server" OnClick="">LinkButton</asp:LinkButton>
      

  2.   

    你要的时间 应该是后代代码啥  直接双击按钮就好了啥 onclick!
      

  3.   

    <asp:CommandField ShowInsertButton="true" ShowEditButton="true" ShowDeleteButton="true" HeaderText="操作" />这个就可以实现【添加】,【删除】,【编辑】的功能啊!后台Code:
    protected void gv_Linkman_RowUpdating(object sender, GridViewUpdateEventArgs e)
            {}protected void gv_Linkman_RowDeleting(object sender, GridViewDeleteEventArgs e)
            {}protected void gv_Linkman_RowEditing(object sender, GridViewEditEventArgs e)
            {
                gv_Linkman.EditIndex = e.NewEditIndex;
                gv_Linkman.DataSource = SW.BS.Facade.FPriceInfo.GetAllDataInfo();
                gv_Linkman.DataBind();
            }
            protected void gv_Linkman_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
            {
                gv_Linkman.EditIndex = -1;
                gv_Linkman.DataSource = SW.BS.Facade.FPriceInfo.GetAllDataInfo();
                gv_Linkman.DataBind();
            }在剩下的自己套用把!!!