I have a radGrid with EnablePostBackOnRowClick="True".
it includes an OnSelectedIndexChanged event: OnSelectedIndexChanged="grdSpecialtyMedTasks_OnSelectedIndexChanged"
It includes a column :<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" ItemStyle-Width="20px"/>
My codebehind includes :
protected void grdSpecialtyMedTasks_OnSelectedIndexChanged(object sender, EventArgs e)
{ // when I click a row, I hit this code every time
GridDataItem selectedItem = (GridDataItem)grdSpecialtyMedTasks.SelectedItems[0];
DropDownList ddlDest = (DropDownList)selectedItem.FindControl("ddlDest");
if (ddlDest.SelectedValue != "Default")
{
btnProcessTask.Enabled = true;
}
...
protected void btnProcessTask_Click(object sender, EventArgs e)
{
if (grdSpecialtyMedTasks.SelectedItems[0] != null) // occasional index out of range error hits here
{
processTask(sender, e);
}
}
---------------------------
When user selects anywhere in the row, the client select checkbox is checked and vices-versa, so that seems to work nicely.
Also when either of the above happens I can see that the OnSelectedIndexChanged fires as I hit a breakpoint each time. (double click hits breakpoint twice.)
Problem is that the row does not APPEAR to have been selected / does not get highlighted until the user double-clicks the row. WHY?
In case it matters, both times when I hit breakpoint in the OnSelectedIndexChanged method, IsPostBack is set to True.
The potential is that the user thinks they are processing Row X when in fact they are processing Row Y.
Also, occasionally I am getting am index out of range error in the btnProcessTask_Click method.
--------------------------
Any assistance greatly appreciated :)