I have a "Select Record" GridButtonColumn inside my grid. I am hooking into the onclick event of that button to call a Javascript method, which works fine. But in that method, I can't figure out how to determine which row was clicked. SelectedItems is empty because my Javascript is being called before the grid selects the row.
And I can't use the onRowSelected event because I want my logic to occur only when they click on my grid button, not if they simply select a row by clicking the row in any area outside of my button.
In the server-side "ItemCreated" event, where my JavaScript call is constructed, I try passing the ClientRowIndex property of the GridButtonColumn data item, but it's always -1.
Thanks.
And I can't use the onRowSelected event because I want my logic to occur only when they click on my grid button, not if they simply select a row by clicking the row in any area outside of my button.
In the server-side "ItemCreated" event, where my JavaScript call is constructed, I try passing the ClientRowIndex property of the GridButtonColumn data item, but it's always -1.
if (e.Item is GridDataItem)
{
LinkButton lb = (LinkButton)(((GridDataItem)e.Item)["SelectRecord"].FindControl("ctl00"));
lb.Attributes.Add("onclick", "return onSelectClient('" + LookupGrid.ClientID + "'," + e.Item.ClientRowIndex + ")");
}
Thanks.