Hi,
I have a asp linkbutton inside a Telerik GridTemplateColumn. When I click on the link button, I should be able to get the index of the row I clicked.
I am not able to achieve this. The event that fires when I click the link button has arguments as " object sender, EventArgs e". Had it been GridDataItem instead of EventArgs, I would have got the value of e and used it.
Please suggest a simple way in which I can get the row index. Below is the snippet of the code which isnt giving me the proper value.
.aspx :
<telerik:gridtemplatecolumn itemstyle-horizontalalign="Center" xmlns:telerik="#unknown">
<itemstyle bordercolor="Black" borderwidth="1px" horizontalalign="center" font-bold="false">
Font-Size="11px" BackColor="White" Width="30px" />
<itemtemplate>
<asp:LinkButton OnClientClick="DisableAllButtons();" OnClick="ConditionHistoryLinkButton_Click"
ID="ConditionHistoryLink" runat="server" Text="Hist" />
.cs :
protected void ConditionHistoryLinkButton_Click(object sender, EventArgs e)
{
GridDataItem item = (GridDataItem)(sender as LinkButton).NamingContainer;
int rowIndex = item.RowIndex;
}
Any help is very much appreciated. Thanks !