RadGrid Disappears after a paging request

6 posts, 0 answers
  1. Jon
    Jon avatar
    24 posts
    Member since:
    Apr 2009

    Posted 23 Jan 2010 Link to this post

    Simple grid populated on the page load from a data table

    loads fine

    but if you then select any of the paging controls to move to another page it disappears

    please see the following video


    the page is within a master page which has this code in it

        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
            <Scripts> 
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
            </Scripts> 
        </telerik:RadScriptManager>  


    Then within the page itself its like this:

                        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
                            <ajaxsettings> 
                                <telerik:AjaxSetting AjaxControlID="RadGridGroups"
                                    <UpdatedControls> 
                                        <telerik:AjaxUpdatedControl ControlID="RadGridGroups" /> 
                                    </UpdatedControls> 
                                </telerik:AjaxSetting> 
                            </ajaxsettings> 
                        </telerik:RadAjaxManager> 
                        <strong>Groups:</strong> 
                        <telerik:RadGrid ID="RadGridGroups" runat="server" AllowPaging="true" 
                            PageSize="5" GridLines="None" width="95%"
                            <clientsettings allowkeyboardnavigation="true" enablepostbackonrowclick="true"
                                <Selecting AllowRowSelect="true" /> 
                            </clientsettings> 
                            <mastertableview datakeynames="Group_ID" /> 
                            <pagerstyle mode="NextPrevAndNumeric" /> 
                        </telerik:RadGrid> 


    Any ideas what its doing or I am missing or doing wrong?

    Thanks

    Jon.
  2. Jon
    Jon avatar
    24 posts
    Member since:
    Apr 2009

    Posted 24 Jan 2010 Link to this post

    After much searching fixed it, found that I needed to rebind my data on the following events:

        Protected Sub RadGridGroups_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles RadGridGroups.PageIndexChanged 
            FillDataInGrid() 
        End Sub 
     
        Protected Sub RadGridGroups_PageSizeChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageSizeChangedEventArgs) Handles RadGridGroups.PageSizeChanged 
            FillDataInGrid() 
        End Sub 

    That sorted it, also Where I was setting the datasource I had a .databind() which when using nested master tables you must not use
  3. vedant
    vedant avatar
    6 posts
    Member since:
    Aug 2011

    Posted 12 Apr 2012 Link to this post

    Thanks,

     I had same issue , not sure why it disappear after paging but it is fixed now.
  4. Roukaya
    Roukaya avatar
    17 posts
    Member since:
    Aug 2012

    Posted 14 Jul 2012 Link to this post

    vedant ..
    how u fixed it ???

    thanks in advance ..
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Jul 2012 Link to this post

    Hi Roukaya,

    Paging, Sorting and Filter works fine when the RadGrid is bound with Advanced Data-binding (using NeedDataSource event). Please take a look into the following sample code snippet which uses Advanced Data-binding.

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowPaging="true"
    onneeddatasource="RadGrid1_NeedDataSource">
        <MasterTableView>
            <Columns>
                <telerik:GridBoundColumn UniqueName="OrderID" HeaderText="OrderID" DataField="OrderID"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="ShipName" HeaderText="ShipName" DataField="ShipName"></telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

    C#:
    public static string connection = WebConfigurationManager.ConnectionStrings["NorthwindConnectionString3"].ConnectionString;
    SqlConnection conn = new SqlConnection(connection);
    public SqlCommand SqlCommand = new SqlCommand();
    protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        string selectQuery1 = "select top 100 OrderID,ShipName from Orders";
        SqlDataAdapter adapter1 = new SqlDataAdapter(selectQuery1, conn);
        DataTable dt1 = new DataTable();
        conn.Open();
        adapter1.Fill(dt1);
        conn.Close();
        RadGrid1.DataSource = dt1;
    }

    Please provide your code if it doesn't help.

    Thanks,
    Shinu.
  6. Darius
    Darius avatar
    13 posts
    Member since:
    Nov 2017

    Posted 16 Jan 2018 in reply to Jon Link to this post

    Thanks for posting the fix. Rebinding the grid to the datasource in these events resolved my issue of the grid disappearing.
Back to Top