if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
CheckBox chkbx = (CheckBox)item["ClientSelectColumn"].Controls[0];
chkbx.AutoPostBack =
true;
chkbx.Attributes.Add(
"OnClick", "return alert('" + chkbx.Checked + "');");
}
But every time, the value is displayed as false after I check the box. I just want to get the value of the checkbox after it is selected.
14 Answers, 1 is accepted

If there is a scenario where the grid only has one row, the user should be able to uncheck the checkbox after checking it.

You can use 'OnRowSelected' and 'OnRowDeselected' ClientEvent of RadGrid' which will fire when you select/deselect the rows in Radgrid. Sample code is given below.
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"false"
DataSourceID
=
"SqlDataSource1"
AllowMultiRowSelection
=
"false"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
DataKeyNames
=
"EmployeeID"
EditMode
=
"InPlace"
>
<
Columns
>
<
telerik:GridClientSelectColumn
UniqueName
=
"ClientSelectColumn"
>
</
telerik:GridClientSelectColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
Selecting-AllowRowSelect
=
"true"
>
<
ClientEvents
OnRowSelected
=
"RowSelected"
OnRowDeselected
=
"RowDeselected"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
Java Script:
<script type=
"text/javascript"
>
function
RowSelected(sender, args) {
alert(
"true"
);
}
function
RowDeselected(sender, args) {
alert(
"false"
);
}
</script>
Thanks,
Princy.

Thanks for your help.

You can try the following code snippet to access ClientSelectColumn.
C#:
protected
void
grid_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem dataitem = (GridDataItem)e.Item;
CheckBox checkBox = (CheckBox)dataitem[
"ClientSelectColumn"
].Controls[0];
if
(checkBox.Checked )
//checking for condition
{
}
}
}
Thanks,
Princy.

Hi,
I tried to access the clientselectcolumn checkbox from the item_databound event and that seems to be working fine. But how to capture the status change for the check box as it happens through the client side and cannot be captured through the databound event.
For client-side you can use the following event handler:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/events/onrowselected
And for server - the approach demonstrated in this article:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/making-postback-or-ajax-request-on-client-row-click
I hope this will prove helpful.
Regards,
Eyup
Telerik by Progress

Hi, actually the issue is that we add the GridClientSelectColumn but on that command we want to post back to run a serverside code to enable a few other buttons and things on the page. Is this possible to use the GridClientSelectColumn to post back or trigger some kind of grid event when you select the top checkbox in the header?
of course we can just use client side to manually submit the page but I was trying to stick to asp.net events if possible.
so please yes or no can we do a server side post back on the selection of the actual GridClientSelectColumn the top check box in the HEADER.
Thank you,

https://www.telerik.com/forums/select-all-rows-event
The magic is this part:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridHeaderItem)
{
GridHeaderItem headerItem = (GridHeaderItem)e.Item;
CheckBox headerChkBox = (CheckBox)headerItem["GridClientSelectColumn"].Controls[0];
headerChkBox.AutoPostBack = true;
headerChkBox.CheckedChanged += new EventHandler(headerChkBox_CheckedChanged);
}
}

Hi Princy,
How Can get all Selected values id of Using GridClientSelectColumn on ClientSide?.Kindly Explain me.
You can use the following event handler for individual rows:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/events/onrowselected
In order to get all of them on an external action like button click, you can use the get_selectedItems() method:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/gridtableview-object/properties/get_selecteditems()
I also suggest that you examine the sample provided at the last post here:
https://www.telerik.com/support/code-library/get-selected-items-through-all-pages#1eTU8nr-GUG8zfGgOGbIcA
Regards,
Eyup
Progress Telerik



Here you can find proper steps of updating Sitefinity CMS:
https://www.progress.com/documentation/sitefinity-cms/upgrade
If you have further questions, you can open a new thread addressing your queries and select the Sitefinity product.
Regards,
Eyup
Progress Telerik