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

Radgrid paging w. multiple grids in Usercontrols

2 Answers 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 15 Jun 2013, 10:51 PM
Hi All,
I have an Ajax-ified page with six RadGrids. To avoid duplicate code the grid is in a usercontrol that get's loaded into six panels. The datasource for each grid is handled in the "main" page in code-behind.
Everything's working, except for paging. I believe I need to handle the NeedDataSource event, but I'm unsure where to do this.
Thx in advance for help and/or pointers!
Rgds - M.


Pseudocode (code behind)
// SqlConnection sqlconn = ......
// Dataset, fill etc ...
 
// Findcontrol grid in pnl1
grid1.Datasource = ds.Tables[0];
grid1.DataBind();
 
// Findcontrol grid in pnl2
grid2.Datasource = ds.Tables[1];
grid2.DataBind();
 
//etc


Pseudocode (aspx)
<telerik:RadAjaxManager ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Execute">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnl1" />
                    <telerik:AjaxUpdatedControl ControlID="pnl2" />
                    <telerik:AjaxUpdatedControl ControlID="pnl3" />
                     .......
                  </UpdatedControls>
            </telerik:AjaxSetting>
</telerik:RadAjaxManager>
 
<asp:Panel ID="pnl1" runat="server" Visible="false">
        <uc:Grid ID="Grid1" runat="server" />
</asp:Panel>
<asp:Panel ID="pnl2" runat="server" Visible="false">
        <uc:Grid ID="Grid2" runat="server" />
 </asp:Panel>
...

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Jun 2013, 04:39 AM
Hi,

I'm not sure about your requirements,please have a look into this documentation for databinding using needdatasource .
Inorder to set paging for each grid,please add :
grid1.AllowPaging=true;

Thanks,
Princy
0
Marcus
Top achievements
Rank 1
answered on 17 Jun 2013, 06:09 PM
That wasn't the issue. The issue was that the usercontrol containing the grid is loaded multiple times on the page (with different datasources for each grid), so I didn't know where to put the handler for the NeedDataSource event (usercontrol or content page) and/or set the correct datasource for the specific grid.
Solved by using RadGrid.UniqueID.

Thx - M.
Tags
Grid
Asked by
Marcus
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Marcus
Top achievements
Rank 1
Share this question
or