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

RadGrid refrash

3 Answers 118 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Pavel
Top achievements
Rank 1
Pavel asked on 17 Jan 2014, 11:18 AM
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>

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Jan 2014, 03:34 AM
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
0
Pavel
Top achievements
Rank 1
answered on 20 Jan 2014, 06:42 AM
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.
0
Princy
Top achievements
Rank 2
answered on 20 Jan 2014, 12:01 PM
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
Tags
Ajax
Asked by
Pavel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Pavel
Top achievements
Rank 1
Share this question
or