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

RadAjaxManager not refreshing grid when called from custom user control

1 Answer 279 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jitin
Top achievements
Rank 1
Jitin asked on 12 Jun 2015, 11:54 PM

 

Hi all, I have a radgrid that triggers an opening of a radwindow which is inside of a user control. This user control handles the update and insertion of data and then closes to refresh the grid. However, everything seems to work fine except for refreshing the grid, and I can't seem to figure out why.

 Here is the main page:

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Silk">
</telerik:RadAjaxLoadingPanel>
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnResponseEnd="responseEnd">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="telerik">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1"/>
                <telerik:AjaxUpdatedControl ControlID="telerik" />
                <telerik:AjaxUpdatedControl ControlID="contactEditor" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
    <telerik:RadGrid runat="server" ID="telerik" AutoGenerateColumns="False" OnNeedDataSource="telerik_OnNeedDataSource"      OnInsertCommand="telerik_OnInsertCommand"
        OnUpdateCommand="telerik_OnUpdateCommand" OnItemDataBound="telerik_OnItemDataBound" GroupingSettings-CaseSensitive="False" OnItemCommand="telerik_OnItemCommand">
        <MasterTableView DataKeyNames="PRIMARY_KEY">
            <Columns>
                <telerik:GridButtonColumn ButtonType="ImageButton" Text="E" CommandName="Edit2" HeaderText="Edit"/>
                <%-- My other columns to display --%>
            </Columns>
        </MasterTableView>
        <ClientSettings Resizing-AllowColumnResize="True" Scrolling-AllowScroll="True" Selecting-AllowRowSelect="True" ClientEvents-OnPopUpShowing="PopUpShowing" />
    </telerik:RadGrid>
    <icl:ContactEditor runat="server" ID="contactEditor" OnCommitedEvent="contactEditor_OnCommitedEvent"/>
</telerik:RadAjaxPanel>

​Here is the user control:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ContactEditor.ascx.cs" Inherits="ICL_V2.controls.ContactEditor" %>
<telerik:RadWindow ID="radwindow" runat="server" MinWidth="600px" AutoSize="True" DestroyOnClose="True" Behaviors="Move,Resize, Close">
    <ContentTemplate>
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="btnCommit" />
                </AjaxSettings>
            </telerik:RadAjaxManagerProxy>
            <div class="form-template">
                <table>
                    <%-- My textbox's and dropdowns --%>
                </table>
                <asp:Button ID="btnCommit" runat="server" class="form-cmd-button" ValidationGroup="form" OnClick="btnCommit_OnClick" />
            </div>
        </telerik:RadAjaxPanel>
    </ContentTemplate>
</telerik:RadWindow>

​When btnCommit is pressed, the corresponding db update/insert is done and then the event OnCommittedEvent is triggered to refresh the grid. The end of the btn click event:

CloseWindow();
OnCommitedEvent(EventArgs.Empty);

 

And then back in the main page

protected void contactEditor_OnCommitedEvent(object sender, EventArgs e)
{
       setDataSource();
       telerik.Rebind();
}

 

This all works without any ajax enabled, but when the ajax is enabled everything works except for the grid refresh at the end. Can anyone point me in the right direction here?

 

Thanks!

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 15 Jun 2015, 08:11 AM
Hello Jitin,

I would suggest you to perform manual Ajax request for updating the Grid as demonstrated in the online demo below:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid

I hope this helps.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Ajax
Asked by
Jitin
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or