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

Get checkstate from GridClientSelectColumn serverside

2 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karlheinz
Top achievements
Rank 1
Karlheinz asked on 16 Apr 2015, 11:24 AM

Hello 

I am using a gridview which is having GridClientSelectColumn.

Is there any way to get the checkstate of a row serverside ?

I tried the following, but checkbox is never checked

   foreach (GridDataItem item in oGridFields.Items) {
        CheckBox chk = (CheckBox)item["prgSel"].Controls[0];
        if (chk.Checked) {
  
        }
    }

 

Thanks for any help.

2 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 20 Apr 2015, 12:06 PM
Hi Karlheinz,

Since you are using GridClientSelectColumn I guess that you would like to implement additional logic for the selected items server-side.

Note that you can access these items directly, there is no need to check the state of the checkboxes. You can use the SelectedItems collection of RadGrid.

Check out the following code snippet that illustrates the approach:

protected void Button1_Click(object sender, EventArgs e)
{
    foreach (GridDataItem item in RadGrid1.SelectedItems)
    {
        // additional logic here
    }
}



Regards,
Viktor Tachev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Karlheinz
Top achievements
Rank 1
answered on 20 Apr 2015, 01:29 PM

Hi Victor,

thanks for your answer. It works.

I had to set the DataKeyNames of the Grid.

Tags
Grid
Asked by
Karlheinz
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Karlheinz
Top achievements
Rank 1
Share this question
or