RadGrid refrash

4 posts, 0 answers
  1. Pavel
    Pavel avatar
    3 posts
    Member since:
    Jan 2014

    Posted 17 Jan 2014 Link to this post

    Hello.
    I have RadGrid and RadAjaxManager.
    When I click page number on the RadGrid refrash all page.
    How me do that refrash RadGrid only.

    My code:

    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />

    <telerik:RadAjaxManager ID="RadAjaxManager1" UpdateInitiatorPanelsOnly="true" EnableAJAX="true" runat="server">
      <AjaxSettings>
         <telerik:AjaxSetting AjaxControlID="Panel1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
         </telerik:AjaxSetting>
       </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
        
        <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="20"
            AllowSorting="True" AllowPaging="True" 
            OnPageIndexChanged="RadGrid1_PageIndexChanged" AutoGenerateColumns="False">
            <MasterTableView Width="100%">
                <Columns>
                <telerik:GridBoundColumn DataField="Company" HeaderText="Company">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Project" HeaderText="Project">
                </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 17 Jan 2014 Link to this post

    Hi Pavel,

    I see that you have added Panel1 in your AjaxSetting but i don't see any panel in your code. Please try the following code snippet to refresh only the RadGrid:

    ASPX:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pavel
    Pavel avatar
    3 posts
    Member since:
    Jan 2014

    Posted 20 Jan 2014 Link to this post

    Hi, Prince.
    I change my code:


    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />

    <telerik:RadAjaxManager ID="RadAjaxManager1" UpdateInitiatorPanelsOnly="true" EnableAJAX="true" runat="server">
      <AjaxSettings>
         <telerik:AjaxSetting AjaxControlID="Panel1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
         </telerik:AjaxSetting>
       </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>

    <asp:Panel ID="Panel1" runat="server">
        
        <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="20"
            AllowSorting="True" AllowPaging="True" 
            OnPageIndexChanged="RadGrid1_PageIndexChanged" AutoGenerateColumns="False">
            <MasterTableView Width="100%">
                <Columns>
                <telerik:GridBoundColumn DataField="Company" HeaderText="Company">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Project" HeaderText="Project">
                </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </asp:Panel>


    But this help not.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Jan 2014 Link to this post

    Hi Pavel,

    I was not able to replicate the issue. Here is a sample code snippet that i tried please give it a try:

    ASPX:
    <telerik:RadAjaxManager ID="RadAjaxManager1" UpdateInitiatorPanelsOnly="true" EnableAJAX="true"
        runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Panel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <asp:Panel ID="Panel1" runat="server">
        <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="20" AllowSorting="True" AllowPaging="True"
            OnPageIndexChanged="RadGrid1_PageIndexChanged" AutoGenerateColumns="False">
            <MasterTableView>
                <Columns>
                    <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="OrderDate" HeaderText="OrderDate">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RadGrid1.DataSource = LoadData("SELECT OrderID,OrderDate FROM Orders");
            RadGrid1.DataBind();
        }
    }
    protected void RadGrid1_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)
    {
        RadGrid1.CurrentPageIndex = e.NewPageIndex;
        RadGrid1.DataSource=LoadData("SELECT OrderID,OrderDate FROM Orders");
        RadGrid1.DataBind();
    }
    public DataTable LoadData(string query)
    {
        String ConnString = ConfigurationManager.ConnectionStrings["Northwind_newConnectionString3"].ConnectionString;
        SqlConnection conn = new SqlConnection(ConnString);
        SqlDataAdapter adapter = new SqlDataAdapter();
        adapter.SelectCommand = new SqlCommand(query, conn);
        DataTable myDataTable = new DataTable();
        conn.Open();
        try
        {
            adapter.Fill(myDataTable);
        }
        finally
        {
            conn.Close();
        }
        return myDataTable;
    }

    Thanks,
    Princy
Back to Top