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

[Solved] Using Mulitiple Grids in one Panel

2 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 08 Jul 2009, 05:56 AM
Hi anyone. Have you guys got an experience on using multiple grids in one panel?
My problem is... when I select a row in a grid,  the other selected grid should be deselected.  Now when I enable the enable rowpostback, the seem to have rebinding for all the grid that causes a log time or delay.  Is there another way to do it without enable the enable rowpostback on selection?

Your ideas are highly appreciated.  Thanks.

Alex ....

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Jul 2009, 07:59 AM
Hi Alex,

From the above post I guess that you are having two Grids in a page and you trying to deselect the rows in a Grid when the other Grid is selected. Try with the following client side approach and see whether it helps.

ASPX:
 
  <telerik:RadGrid ID="RadGrid1" runat="server"   GridLines="None"  AllowMultiRowSelection="true" DataSourceID="SqlDataSource1"     /> 
            <MasterTableView AutoGenerateColumns="true" > 
              
                <Columns> 
                 <telerik:GridClientSelectColumn></telerik:GridClientSelectColumn> 
                </Columns> 
            </MasterTableView> 
             
            <ClientSettings  > 
              <Selecting  AllowRowSelect="true" /> 
               <ClientEvents  OnRowSelecting="RowSelecting" /> 
            </ClientSettings> 
            
        </telerik:RadGrid> 
 
 
 <telerik:RadGrid ID="RadGrid2" runat="server"   GridLines="None"  AllowMultiRowSelection="true" DataSourceID="SqlDataSource2"   OnNeedDataSource="RadGrid2_NeedDataSource"
            <MasterTableView AutoGenerateColumns="true" > 
              
                <Columns> 
                 <telerik:GridClientSelectColumn></telerik:GridClientSelectColumn> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings> 
             <Selecting  AllowRowSelect="true" /> 
             <ClientEvents  OnRowSelecting="RowSelecting"/> 
            </ClientSettings> 
        </telerik:RadGrid> 


JS:
 
<script type="text/javascript" > 
 
   function RowSelecting(sender, eventArgs) 
    { 
        var targetGrid; 
        var Grid1=$find("<%=RadGrid1.ClientID %>");   
        var Grid2=$find("<%=RadGrid2.ClientID %>");   
           
        if(sender.ClientID==Grid1.ClientID) 
           targetGrid=Grid2; 
        else 
         targetGrid=Grid1; 
           
     // to deselect the rows of the other Grid 
        var MasterTable = targetGrid.get_masterTableView(); 
 
           var selectedRows = MasterTable.get_selectedItems(); 
           for (var i = 0; i < selectedRows.length; i++) 
           { 
              selectedRows[i].set_selected(false); 
 
             
           } 
    } 
 
</script> 


Thanks
Shinu
0
Alex
Top achievements
Rank 1
answered on 11 Jul 2009, 02:17 PM
Thank you very much Shinu.  It actually works. I appreciate it so much. Thanks again!!!

Alex
Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Alex
Top achievements
Rank 1
Share this question
or