This is a migrated thread and some comments may be shown as answers.

RadGrid does not highlight row until selected twice

1 Answer 26 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Judy asked on 07 Oct 2016, 05:12 PM

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 :)



1 Answer, 1 is accepted

Sort by
Viktor Tachev
Telerik team
answered on 12 Oct 2016, 10:34 AM
Hi Judy,

Note that the ClientSelectColumn is intended to be used for client-side selection. If you would like to have server-side selection in the Grid I would recommend to use the approach described in the following article.

Moreover, for disabling the button you can use client-side logic. Please examine the following code-snippets that illustrate the approach. Give it a try and let me know how it works for you.

<telerik:GridTemplateColumn UniqueName="TemplateColumn">
        <asp:Button ID="Button1" Text="Click" runat="server" />

<ClientSettings EnablePostBackOnRowClick="true">
    <ClientEvents  OnRowCreated="rowCreated" />
    <Selecting AllowRowSelect="true" />

function rowCreated(sender, args) {
    var grid = sender;
    var dataItem = args.get_gridDataItem();
    var templateColumn = dataItem.get_cell("TemplateColumn");
    var button = $telerik.findElement(templateColumn, "Button1");
    if (!dataItem.get_selected()) {
        button.disabled = "disabled";

Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Asked by
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question