when gridview container hold the button, then you have to find that control if you want to use any click event
<asp:GridView ID="GridView1" runat="server" DataKeyNames="empno"
AutoGenerateColumns="false" onrowcommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField HeaderText="Employee no">
<itemtemplate>
<asp:LinkButton CommandName="cmdBind" runat="server" Text='<%#Eval("empno")%>' ID="hypeno" ToolTip='<%#Eval("empno")%>'>LinkButton
</asp:LinkButton>
</itemtemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Employee Name" DataField="empname" />
<asp:BoundField HeaderText="Employee Salary" DataField="Salary" />
</Columns>
</asp:GridView>
Server Side Code
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "cmdBind")
{
LinkButton lb = (LinkButton)e.CommandSource;
Response.Redirect("GridHypher2.aspx?eno=" + lb.Text + "");
}
}
Hope this Will Help You!
www.TechnologyBrunch.com
www.geekblogtips.com
Rajnish Singh, if this helps please login to Mark As Answer. | Alert Moderator