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

radgrid

2 Answers 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AK
Top achievements
Rank 1
AK asked on 11 Dec 2012, 07:17 PM
Hi,

I am trying to add checkboxcolumn to support selection of rows in the RadGrid Control

I have tried both client and server side approaches but have issues with both the approaches. I have ran throught the samples provided
 the server side approach seems to work fine.

My Requirement is to be able to  capture the selected rows on the server side apart from selecting and deselecting the rows
on the grid. let me know the suggested apprach.

I have tried the Server side approach but the Toggle events are getting fired in wrong order.
For example if I select the Checkbox in the HeaderRow the ToggleSelectedState gets fired on first check but on unchecking the
same CheckBox ToggleRowSelection gets fired henceforth whihc is not what the expected behaviour should be. Please see attached file for the radgrid aspx code.

<
telerik:GridTemplateColumn UniqueName
="CheckBoxTemplateColumn">
<HeaderTemplate
>
<asp:CheckBox ID="headerChkbox" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" runat="server"></asp:CheckBox
>
</HeaderTemplate
>
<ItemTemplate
>
<asp:CheckBox ID="CheckBox1" OnCheckedChanged="ToggleRowSelection" AutoPostBack="True"

runat
="server">


If I had to use the Client side approach how will I be able to capture the selected rows on the server side. If you can provide us some sample as attahced project It would be of great help!

<telerik:GridClientSelectColumn UniqueName="grdClinetSelectCol"></telerik:GridClientSelectColumn>

</asp:CheckBox>
</ItemTemplate>
</telerik:GridTemplateColumn>

Thanks
Kumar

2 Answers, 1 is accepted

Sort by
0
AK
Top achievements
Rank 1
answered on 11 Dec 2012, 07:20 PM
Forgot to add the Selected Rows needs to be captured on button click external to the Grid With the Client Side approach.
0
Shinu
Top achievements
Rank 2
answered on 26 Dec 2012, 06:16 AM
Hi,

Please check the following code snippet to access the selected row from server side on an external button click.

C#:
protected void Button1_Click(object sender, EventArgs e)
{
    foreach (GridDataItem ditem in rgServiceAuthorizationList.SelectedItems)
    {
        //Access the selected item here.
    }
}

Please take a look into this help documentation for Selecting a Row with a CheckBox (Server-side).

Thanks,
Shinu.
Tags
Grid
Asked by
AK
Top achievements
Rank 1
Answers by
AK
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or