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

RadGrid CheckBox Selection

4 Answers 108 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
john
Top achievements
Rank 1
john asked on 24 Apr 2011, 10:51 AM
Hi,

   I am using RadGrid ,an d i have given ClientselectColumn for multiselect.
From the server side am using following code

string

 

script = string.Empty;

 

 

script = script +

"selected = new Array();";

 

 

 

foreach (int id in lstselectedIDS)

 

 

{

 

script = script +

"selected.push(\"" + id + "\");";

 

 

}

 

script +=

"SetSelectedRowCount();";

 

 

 

base.AddStartupScript(script);

from the client side am taking the elements in the selected array and making the selection in Rowcreated event  like this

 

 

function

 

Grid_RowCreated(sender, args) {

 

 

 

 

var _Id = args.getDataKeyValue(sender.get_masterTableView().get_name());

 

 

 

 

if (selected.contains(_Id)) {

 

 

args.get_gridDataItem().set_selected(

 

true);

 

 

}
}

Because of this when ever i click on Check box for deselecting it is happening correctly. But if i click again for selecting it it is not happening properly. I need click checkbox 2 times for making a selection.

This is happening only for the selected rows.

If i use server side selection in ItemdataBoud Event, am not getting this problem.
Like
e.Item.Selected=true;
But i need to use the former one

And also am facing this problem in  many screens,please help me by giving the solution as soon as possible.


Thanks,
John

4 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 28 Apr 2011, 08:36 AM
Hello John,

Please try using the selectItem client-side method in order to select the item and let me know whether it helps.

All the best,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Badri
Top achievements
Rank 1
answered on 06 May 2011, 03:36 AM
Hi John,

Try this.
From the client side,When ever if u click first time on check box try to capture the selectedindexes.

I think it might storing duplicate indexes.
For example 2 rows are selected in the grid. Check that selectedindexes contains (0,0,1,1) instead of (0,1).
U can remove that many on first time deselecting.


Thanks,
Badri
0
Mira
Telerik team
answered on 11 May 2011, 11:44 AM
Hello,

Could you please send us the complete code you use for storing the selected indexes and for retrieving them?
We will examine it and get back to you with our findings.

Additionally, you can review the following code libraries in which similar functionality is implemented:
Selecting/Deselecting rows on clicking row itself and without interfering selected items
RadGrid client side toggle selection with server side persisting of the selected items after Sorting, Filtering and Paging

I hope this helps.

Best wishes,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
john
Top achievements
Rank 1
answered on 12 May 2011, 04:21 AM
Thank you very much badri

Its working for me.
Tags
General Discussions
Asked by
john
Top achievements
Rank 1
Answers by
Mira
Telerik team
Badri
Top achievements
Rank 1
john
Top achievements
Rank 1
Share this question
or