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

Client-Side Row Selection Persisted With Paging

13 Answers 473 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pjmealy
Top achievements
Rank 1
pjmealy asked on 09 Sep 2008, 10:42 AM
Hi,
I have implemented the suggested solution for this .. with the postbacks and storing the info in the viewstate etc...
But I'm afraid its just not good enough... I have to support some users on dialup... and they are complaining bitterly about all the postbacks..
It does seem kinda clunky to have to postback every time a user clicks on a checkbox...
Is there no way to do this stuff on the client side at all? Without having to postback I mean?

Thanks
PJ

13 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 09 Sep 2008, 01:04 PM
Hello pjmealy,

You can do this easily using RadGrid client-side API. I have attached small example to illustrate you how to persist the selection on client.

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
pjmealy
Top achievements
Rank 1
answered on 09 Sep 2008, 01:57 PM
thanks very much for your very quick response.

I'm looking at the code now, but can;t get the example to compile.. but thats allright.. i get the idea.

The script block needs to be in the head of the page.... and I'm using the grid control inside a user control which is used in a page which uses a masterpage.....
So I'm a bit unsure about how to proceed... should I put the script block  in the head of the masterpage yeah?

Thanks

PJ
0
Sebastian
Telerik team
answered on 09 Sep 2008, 02:01 PM
Hello pjmealy,

You can try putting the script block either in the head section of your master page or within the content page holding the grid instance.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
pjmealy
Top achievements
Rank 1
answered on 09 Sep 2008, 02:07 PM
Thank you... i just tried to putting it in both places (one at a time..) and got " Object reference not set to an instance of an object" ...
But i think i have a version problem to deal with first... my grid tag reads: radG:RadGrid while the one in your example reads: telerik:RadGrid

So .. now i'm wondering which version of the controls you are using in this example?
I'm using Q12007 in this app.... do I have to upgrade to the prometheus versions is it? Would this work with the Q1 2007 controls?

Thanks

PJ
0
Sebastian
Telerik team
answered on 09 Sep 2008, 02:23 PM
Hello pjmealy,

Indeed you need to migrate to the ASP.NET AJAX version of RadGrid in order to utilize the solution presented in my colleague Vlad's project. Instructions about how to make the transition you can find in these online resources:

http://www.telerik.com/support/kb/article/b454K-kad-b454T-bah-b454c-bah.aspx
http://www.telerik.com/help/aspnet-ajax/grdmigrationtoprometheus.html

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
pjmealy
Top achievements
Rank 1
answered on 09 Sep 2008, 02:55 PM
Thanks for that...
Looking at my client.net it appears our subscription has run out as all i ahve available to download under Rad Controls for ASP.NET AJAX are trial versions.

So, is there a solution that will work with the version of the controls that I have currently?

Thanks
PJ
0
pjmealy
Top achievements
Rank 1
answered on 09 Sep 2008, 03:52 PM
Its ok guys, I figured it out.
You should have told me to RTFM .. heh heh...
For the older controls I'm using the following client settings...

<ClientSettings AllowExpandCollapse="True" ApplyStylesOnClient="True" EnablePostBackOnRowClick="True"
        <Selecting AllowRowSelect="True" /> 
        <ClientEvents OnRowCreated="merchant_RowCreated" OnRowDeselected="merchant_RowDeselected" 
                                        OnRowSelected="merchant_RowSelected" /> 
</ClientSettings> 

and then used the same javascript..
Works lovely...

Thanks for your help, it put me on the right track...
PJ


0
Mike
Top achievements
Rank 1
answered on 11 Sep 2008, 03:37 PM
How do you get it to only check the checkboxes that were checked and not all of them?
0
pjmealy
Top achievements
Rank 1
answered on 11 Sep 2008, 03:41 PM
Well,
not sure what problem you are having ... if you are using the version of the controls that I am using then you need to modify the javascript as follows:

<script type="text/javascript">  
        var selected = {};  
 
 
        function  merchant_RowSelected(rowObject)  
         {  
           var MerchantID = this.GetCellByColumnUniqueName(rowObject,"MerchantID").innerHTML;  
           if (!selected[MerchantID]) {  
                selected[MerchantID] = true;  
            }  
         }  
 
        function  merchant_RowDeselected(rowObject)  
         {  
           var MerchantID = this.GetCellByColumnUniqueName(rowObject,"MerchantID").innerHTML;  
           if (!selected[MerchantID]) {  
                selected[MerchantID] = null;  
            }  
         }  
           
         function  merchant_RowCreated(rowObject)  
         {  
           var MerchantID = this.GetCellByColumnUniqueName(rowObject,"MerchantID").innerHTML;  
           if (selected[MerchantID]) {  
                rowObject.set_selected(true)  
            }  
         }  
 
</script> 

HTH
PJ
0
Mike
Top achievements
Rank 1
answered on 11 Sep 2008, 03:43 PM
Shinu this is not what I am looking for.
0
tomekm
Top achievements
Rank 1
answered on 06 Mar 2009, 09:23 AM
I tried your example and it worked. However, on server-side I checked RadGrid.SelectedItems and it stores only selected items from the current page. Is there a solution for that?
0
nelson
Top achievements
Rank 1
answered on 16 Jun 2010, 11:26 AM

hi, i bind a employee table to my RadGrid so my columns for RadGrid are 'emp_name', 'emp_dept', 'emp_city'.

now, what i want is when i select a perticular row of RadGrid i need to access all the values of that perticular row in a javascript function.

i tried to find these values in 'args' but i havn't found the luck.

Please help.

0
Shinu
Top achievements
Rank 2
answered on 17 Jun 2010, 02:25 PM
Hello Nelson,

Here is the documentation which describes how to fetch cell values of selected rows on client.
Getting cell values for selected rows client side

-Shinu.
Tags
Grid
Asked by
pjmealy
Top achievements
Rank 1
Answers by
Vlad
Telerik team
pjmealy
Top achievements
Rank 1
Sebastian
Telerik team
Mike
Top achievements
Rank 1
tomekm
Top achievements
Rank 1
nelson
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or