Hi,
I have enable <ClientSettings>
I have enable <ClientSettings>
<Selecting AllowRowSelect="true" />
</ClientSettings>
Now when I select any row in the Grid. There will a check box in the Grid ItemTemplate. that should be checked
and unchecked. please help me on this issue.
7 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 17 Mar 2011, 01:54 PM
Hello Venkatesh,
You can achieve this bt attaching the ClientEvents OnRowSelecting and OnRowDeselecting. Here is the sample code.
aspx:
ClientSide:
Thanks,
Shinu.
You can achieve this bt attaching the ClientEvents OnRowSelecting and OnRowDeselecting. Here is the sample code.
aspx:
<
ClientSettings
ClientEvents-OnRowSelecting
=
"OnRowSelecting"
ClientEvents-OnRowDeselecting
=
"OnRowDeselecting"
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
ClientSide:
function
OnRowSelecting(sender, args)
{
args.get_gridDataItem().findElement(
"CheckBox1"
).checked =
true
;
}
function
OnRowDeselecting(sender, args) {
args.get_gridDataItem().findElement(
"CheckBox1"
).checked =
false
;
}
Thanks,
Shinu.
0

Venkatesh
Top achievements
Rank 1
answered on 17 Mar 2011, 02:34 PM
Shinu,
Thanks for the Reply but this is code is showing some error while running.
Thanks for the Reply but this is code is showing some error while running.
get_gridDataItem()
is null or not an object0

Shinu
Top achievements
Rank 2
answered on 18 Mar 2011, 06:21 AM
Hello Venkatesh,
The get_gridDataItem() is not directly available on the client unless OnRowCreating/OnRowCreated events are hooked up. This is done for optimization purpose. So try attaching the event.
I found the relevant information from the following documentation.
OnRowSelecting
Thanks,
Shinu.
The get_gridDataItem() is not directly available on the client unless OnRowCreating/OnRowCreated events are hooked up. This is done for optimization purpose. So try attaching the event.
I found the relevant information from the following documentation.
OnRowSelecting
Thanks,
Shinu.
0

Venkatesh
Top achievements
Rank 1
answered on 21 Mar 2011, 12:03 PM
Hi Shinu,
Now i have one issue. when i click a button all the checkbox in the grid should be slected. Those checkbox is in the ItemTemplate of radgrid. Please help me to fix this issue.
Now i have one issue. when i click a button all the checkbox in the grid should be slected. Those checkbox is in the ItemTemplate of radgrid. Please help me to fix this issue.
0

Shinu
Top achievements
Rank 2
answered on 21 Mar 2011, 01:14 PM
Hello Venkatesh,
Try the following code snippet to select all CheckBoxes in a button click.
ASPX:
Java Script:
-Shinu.
Try the following code snippet to select all CheckBoxes in a button click.
ASPX:
<
asp:Button
ID
=
"Button2"
runat
=
"server"
Text
=
"Button"
OnClientClick
=
"selectAll();"
/>
Java Script:
<script type=
"text/javascript"
>
function
selectAll() {
var
grid = $find(
"<%=RadGrid1.ClientID %>"
);
var
MasterTable = grid.get_masterTableView();
var
length = MasterTable.get_dataItems().length;
for
(
var
i = 0; i < length; i++) {
MasterTable.get_dataItems()[i].findElement(
"CheckBox1"
).checked =
true
;
}
}
</script>
-Shinu.
0

Venkatesh
Top achievements
Rank 1
answered on 21 Mar 2011, 01:20 PM
Thanks shinu,
When you do that the rows are not selected. how to do that? Attached the screenshot
When you do that the rows are not selected. how to do that? Attached the screenshot
0
Hi Venkatesh,
Here is how you can implement server-side selection with checkbox which resides in the header/item template of a GridTemplateColumn:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectrowwithcheckbox/defaultcs.aspx
Alternatively, you can take advantage of the GridClientSelectColumn to support client-side selection as illustrated in the second grid here:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/selecting/defaultcs.aspx
Review the description/code snippets from the demos for more details.
Kind regards,
Sebastian
the Telerik team
Here is how you can implement server-side selection with checkbox which resides in the header/item template of a GridTemplateColumn:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectrowwithcheckbox/defaultcs.aspx
Alternatively, you can take advantage of the GridClientSelectColumn to support client-side selection as illustrated in the second grid here:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/selecting/defaultcs.aspx
Review the description/code snippets from the demos for more details.
Kind regards,
Sebastian
the Telerik team