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

How do I select the row using server side with just a click on the row?

2 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andre Vovan
Top achievements
Rank 1
Andre Vovan asked on 01 Aug 2008, 02:08 AM
Hey, everytime I use client allow row selection I can get the entire row to be highlighted.

How do I just click on the row and do the same for the server side selection?  I really don't want a button or a checkbox to select the row, I just want to click on the row once and be able to select the row.

Thanks

2 Answers, 1 is accepted

Sort by
0
Kevin Babcock
Top achievements
Rank 1
answered on 01 Aug 2008, 04:02 AM
Hello Peter,

In order to select a row on the client, have it post back to the server, and raise the SelectedIndexChanged event on the server, you have to set two simple properties. In the <ClientSettings> collection of your RadGrid, set the AllowRowSelect and EnablePostBackOnRowClick properties to true. Here is a quick example:

<telerik:RadGrid ID="RadGrid1" runat="server"  
    OnNeedDataSource="RadGrid1_NeedDataSource" 
    OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged"
    <ClientSettings EnablePostBackOnRowClick="true"
        <Selecting AllowRowSelect="true" /> 
    </ClientSettings>        
</telerik:RadGrid> 

I hope this helps. If you need further assistance, please let me know.

Sincerely,
Kevin Babcock
0
Shinu
Top achievements
Rank 2
answered on 01 Aug 2008, 05:18 AM
Hi Peter,

You can also try the following code snippet.

ASPX:
 <ClientSettings EnablePostBackOnRowClick="true" > 
               </ClientSettings> 

CS:
 protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == "RowClick") 
        { 
            e.Item.Selected = true
        } 
    } 


Hope this helps..
Shinu.
Tags
Grid
Asked by
Andre Vovan
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or