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

RadWindow disappear on partial postback

3 Answers 278 Views
Window
This is a migrated thread and some comments may be shown as answers.
Lakpa
Top achievements
Rank 1
Lakpa asked on 20 Jan 2014, 09:32 PM
Hi,
   I am having a problem with RadWindow disappearing after partial postback.

1. I use a RadScheduler with AdvanceForm Mode and on AdvanceInsertTemplate I have my "USERCONTROL". This RadScheduler is linked with RadAjaxManager.
2. That "USERCONTROL" has a button that pop up RadWindow and that RadWindows has a "SEARCH BUTTON" to display a list in grid.
3. When I click the  "SEARCH BUTTON" , the radwindow disappear.
4. RadScriptManagerProxy is linked with the "SEARCH BUTTON".

I can't figure out why its not working.

In Asp.net if the controls were kept inside an update panel, then the popup wasn't suppose to disappear after partial postback.

Thanking you
Lakpa Sherpa

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Jan 2014, 05:58 AM
Hi Lakpa,

Please have a look into the sample code snippet which works fine at my end.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadScheduler1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadScheduler ID="RadScheduler1" runat="server" DataSourceID="SqlDataSource1"
    DataKeyField="ID" DataEndField="End" DataStartField="Start" DataSubjectField="Subject"
    DayStartTime="08:30:00">
    <AdvancedForm Modal="true" EnableTimeZonesEditing="true" />
    <AdvancedInsertTemplate>
        <div class="rsAdvancedEdit rsAdvancedModal" style="position: relative">
            <div class="rsModalBgTopLeft">
            </div>
            <div class="rsModalBgTopRight">
            </div>
            <div class="rsModalBgBottomLeft">
            </div>
            <div class="rsModalBgBottomRight">
            </div>
            <div class="rsAdvTitle">
                <h1 class="rsAdvInnerTitle">
                    <%# Container.Appointment.Owner.Localization.AdvancedNewAppointment %></h1>
                <asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose"
                    CommandName="Cancel" CausesValidation="false" ToolTip='<%# Container.Appointment.Owner.Localization.AdvancedClose %>'>
<%# Container.Appointment.Owner.Localization.AdvancedClose%>
                </asp:LinkButton>
            </div>
            <div class="rsAdvContentWrapper">
                <telerik:RadTextBox ID="SubjectTextBox" runat="server" Text='<%# Bind("Subject") %>'
                    Label='<%# Container.Appointment.Owner.Localization.AdvancedSubject%>'>
                </telerik:RadTextBox>
                <p>
                    <uc1:WebUserControl ID="WebUserControl1" runat="server" />
                </p>
                <asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea">
                    <div class="rsAdvButtonWrapper">
                        <asp:LinkButton CommandName="Update" runat="server" ID="UpdateButton" CssClass="rsAdvEditSave">
<span><%# Container.Appointment.Owner.Localization.Save%></span>
                        </asp:LinkButton>
                        <asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel"
                            CausesValidation="false">
<span><%# Container.Appointment.Owner.Localization.Cancel%></span>
                        </asp:LinkButton>
                    </div>
                </asp:Panel>
            </div>
        </div>
    </AdvancedInsertTemplate>
    <AdvancedEditTemplate>
        <asp:Label ID="label1" runat="server" Text="demo">
        </asp:Label>
    </AdvancedEditTemplate>
</telerik:RadScheduler>

UserControl :
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadWindow1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadButton2" />
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadButton2">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadButton ID="RadButton1" runat="server" Text="Open" OnClick="RadButton1_Click">
</telerik:RadButton>
<telerik:RadWindow ID="RadWindow1" runat="server">
    <ContentTemplate>
        <telerik:RadButton ID="RadButton2" runat="server" Text="Search Button" OnClick="RadButton2_Click1">
        </telerik:RadButton>
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="true"
            Visible="false">
            <MasterTableView>
            </MasterTableView>
        </telerik:RadGrid>
    </ContentTemplate>
</telerik:RadWindow>

UserControl Pgae C#:
protected void RadButton1_Click(object sender, EventArgs e)
{
    RadWindow1.VisibleOnPageLoad = true;
}
protected void RadButton2_Click1(object sender, EventArgs e)
{
    RadGrid1.Visible = true;
}

Let me know if you have any concern.
Thanks,
Shinu.
0
Accepted
Marin Bratanov
Telerik team
answered on 21 Jan 2014, 01:43 PM
Hello Lakoa,

I am copying here my answer from your support ticket on the matter. I am not attaching the code samples because you may not want them public. If you like you can post the logic, or I could attach the same archives from the ticket.

This scenario is quite complex because controls are added during partial postbacks and thus AJAX settings related to them need to be plugged in the page lifecycle after the controls are available.

What I can offer is choosing one of the following options that seem to work fine on my end:
- create AJAX settings programmatically in the FormCreated event of the Scheduler
- OR use standard asp:UpdatePanels because they need not be plugged in the page lifecycle dynamically like our settings need to be.


Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Lakpa
Top achievements
Rank 1
answered on 21 Jan 2014, 02:14 PM
Thank you for your support.
Its working fine now.
Tags
Window
Asked by
Lakpa
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Marin Bratanov
Telerik team
Lakpa
Top achievements
Rank 1
Share this question
or