girdview中点击linkbutton按钮的查询、修改、删除操作

1,直接执行LinkButton中的事件时
    <asp:TemplateField HeaderText="修改">
                      <ItemTemplate>
                              <asp:LinkButton runat="server" ForeColor="Blue" CssClass="linkButton1" ID="lbtnUpdate" OnClick="lbtnUpdate_Click"
                             Text="修改"></asp:LinkButton>
                         <asp:Literal ID="liID" runat="server" Text='<%#Eval("SJBH") %>' Visible="false"></asp:Literal>
                </ItemTemplate>
           </asp:TemplateField>

  后台代码
        protected void lbtnUpdate_Click(object sender, EventArgs e)
        {
            Literal liID = ((sender as LinkButton).NamingContainer as GridViewRow).FindControl("liID") as Literal;
            UpdateSJBH = liID.Text.Trim();
        }

2,

 

posted @ 2013-07-27 15:17  namehwh  阅读(356)  评论(0编辑  收藏  举报