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

Client Side Selecting All Rows From

3 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chamira
Top achievements
Rank 1
Chamira asked on 03 Sep 2008, 05:17 AM
Hi

I downloaded the latest trial version 2008 q2 and it looks excellent.
Is there a way for me to select all rows ( client side ) from an asp button ..

scenario..
there is a button named "Select All Rows Displayed"

and den clickin dat checks da checkboxes of all the rows...

( this can be done by da header checkbox .. bt is it possible via a button )

thanks...

3 Answers, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 03 Sep 2008, 05:49 AM
Hi Chamira,

Upon clicking on the button, you can iterate through all the items in the control, and select them.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Accepted
Shinu
Top achievements
Rank 1
answered on 03 Sep 2008, 05:53 AM
Hi Chamira,

You can try the following JavaScript code to achieve the desired scenario.


ASPX:
<asp:Button ID="BtnSelectAll" runat="server"  OnClientClick="OnClientClick()" Text="SelectAll" /> 
       

JS:
<script type="text/javascript" language="javascript" > 
     function OnClientClick() 
         { 
         var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView(); 
          var DataItem = masterTable.get_dataItems(); 
          for(var i=0;i<DataItem.length;i++) 
          { 
               masterTable.selectItem(masterTable.get_dataItems()[i].get_element()); 
          } 
         } 
</script > 


Hope this helps..
Shinu.
0
Chamira
Top achievements
Rank 1
answered on 03 Sep 2008, 07:37 AM
thanks a lot shinu and yavor...

Does this selection select all the rows.. in the datagrid if pagin was enabled..

Thanks again
Tags
Grid
Asked by
Chamira
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Shinu
Top achievements
Rank 1
Chamira
Top achievements
Rank 1
Share this question
or