Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Link Button event is not getting fired when using it in TemplateDataField of a WebDataGrid
posted
Hi There,

I am using a WebDataGrid in which there is a TemplateDataField.
I have added a Link Button there and added "OnClick" event of a button in Code Behind (C#).
The event is not triggered at any point of time.
I have also put a break point to troubleshoot but the break point is not getting hit anyhow.

I have added sample code here.

.ASPX Page

<
ig:WebDataGrid ID="Users" runat="server" Width="100%" AutoGenerateColumns="false"> <Columns> <ig:BoundDataField DataFieldName="NAME" Key="NAME" CssClass="name"> <Header Text="User Name" CssClass="name" Tooltip="User Name" /> </ig:BoundDataField> <ig:TemplateDataField Key="Edit" CssClass="edit" Width="6%"> <Header CssClass="edit" /> <ItemTemplate>     <asp:LinkButton ID="btnEdit" runat="server" Text="Edit" CausesValidation="false"       OnClick="edit_Click" CommandName="edit_Click"/>   </ItemTemplate>  </ig:TemplateDataField>  </Columns>  </ig:WebDataGrid>


.CS Page

protected void edit_Click(object sender, EventArgs e) { LinkButton edit = sender as LinkButton; try   {       //Do Something
}   catch (Exception ex)   {    throw;   } }

Is it needed to register the event anywhere in code?

Please help.