Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
how to handle click event of linkbutton in gridview in asp.net
Posted

<ItemTemplate>        
        <asp:LinkButton ID="LinkButton1" CommandName="export" OnClick="LinkButton1_Click" runat="server">LinkButton</asp:LinkButton>
    </ItemTemplate>

Row DataBound Event
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
             LinkButton lnk = e.Row.FindControl("LinkButton1") as LinkButton;
             lnk.Click += new EventHandler(LinkButton1_Click);
        }
    }
protected void LinkButton1_Click(object sender, EventArgs e)
   {

   }
 
Share this answer
 
This[^] thread might give you some ideas.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900