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

Window Modal Popup is closed after a PostBack !

2 Answers 1058 Views
Window
This is a migrated thread and some comments may be shown as answers.
Rebeen
Top achievements
Rank 1
Iron
Rebeen asked on 11 Mar 2020, 02:02 PM

 

I have RadWindow popup all things working on it fine just I faced  with a problem is that the RadWindow after PostBack  the RadWindow is closed immediately ..! I mean this event OnSelectedIndexChanged="ddltype_SelectedIndexChanged" has fired however I putted UpdatePanel  in side  

 

<p><telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" Behaviors="Close">                                       <br> </p><p><ContentTemplate></p><p><strong>the UpdatePanel  goes here</strong></p><p></ContentTemplate></p><p></telerik:RadWindow ></p>

 but I getting this error mesasage

Cannot unregister UpdatePanel with ID '' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported. Parameter name: updatePanel

what is wrong with the code thanks in advance

Entire code

 

<p><telerik:RadWindowManager ID="RadWindowManager1" runat="server" Width="400" Height="200"><br>              <br><br>                <Windows><br><br>                    <telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" Behaviors="Close"><br>                       <br>                        <br>                        <ContentTemplate><br><br>                  <br> <br>                                   <br><br><br>                 <asp:DropDownList ID="ddltype" runat="server" OnSelectedIndexChanged="ddltype_SelectedIndexChanged" DataSourceID="sdsCalFeulTypesNew" AutoPostBack="true" DataTextField="CalFeulTypeName" DataValueField="CalFeulTypeId"><br><br>                     <asp:ListItem Selected="True">Select ...</asp:ListItem><br><br><br><br>                 </asp:DropDownList><br><br><br><br><br>                                        <asp:SqlDataSource ID="sdsCalFeulTypesNew" runat="server"<br>                                            ConnectionString="<%$ ConnectionStrings:Myconnectionstring %>"<br>                                            SelectCommandType="StoredProcedure" SelectCommand="SPCommandName"><br><br>                                            <SelectParameters><br><br><br>                                                <asp:Parameter Name="FeulCatFkey" Type="Int32" DefaultValue="1" /><br><br><br>                                            </SelectParameters><br><br>                                        </asp:SqlDataSource><br><br><br><br><br><br><br>                                        <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" CssClass="racSlide" Style="padding: 5px; margin: 5px; width: 70%;" Font-Bold="true"<br>                                            TextSettings-SelectionMode="Single" runat="server" DropDownWidth="240px"<br>                                            InputType="Text" DataSourceID="sdsCalculationName" DataTextField="CalculationName" DataValueField="Calculation_ID"<br>                                            EmptyMessage="Search Items" MinFilterLength="2" MaxResultCount="10" AllowTokenEditing="true"<br>                                            EnableClientFiltering="false" AllowCustomEntry="true"<br>                                            AutoPostBack="false" EnableAjaxSkinRendering="False" EnableTextSelection="True"<br>                                            EnableAriaSupport="True" Filter="StartsWith"><br>                                        </telerik:RadAutoCompleteBox><br><br><br><br><br><br><br><br><br>                                    <div style="margin-top: 60px; margin-left: 10px;"><br><br><br><br>                                        <asp:Button runat="server" ID="btnCancel" CssClass="btn btn-danger" Text="Cancel" Style="margin-top: 5px;" /><br><br><br><br>                                        <asp:Button runat="server" ID="btnNewCalculation" CssClass="btn btn-info" OnClick="btnNewCalculation_Click" Text="Start Calculation" Style="margin-top: 5px;" ValidationGroup="VGCal" /><br><br><br>                                    </div><br><br><br><br><br>                                    <asp:SqlDataSource ID="sdsCalculationName" runat="server"<br>                                        ConnectionString="<%$ ConnectionStrings:Myconnectionstring %>"<br>                                        SelectCommandType="StoredProcedure" SelectCommand="spCommandName"><br>                                        <SelectParameters><br><br><br>                                            <asp:Parameter Name="dep" Type="int16" DefaultValue="1" /><br><br>                                        </SelectParameters><br>                                    </asp:SqlDataSource><br>                        <br><br>                             <br><br><br><br><br>                        </ContentTemplate><br><br>                                 <br>                    </telerik:RadWindow><br><br>    </Windows><br><br>               <br><br><br> <br>            <br>            </telerik:RadWindowManager></p><p></p>

 

 

 

2 Answers, 1 is accepted

Sort by
0
Rebeen
Top achievements
Rank 1
Iron
answered on 11 Mar 2020, 02:09 PM

The code

<telerik:radwindowmanager id="RadWindowManager1" runat="server" width="400" height="200">
               
 
                <Windows>
 
                    <telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" Behaviors="Close" visibleonpageload="true">
                        
                          
                        <ContentTemplate>
                               
 
                                
                  <style>
                      html .racSlide .RadAutoCompleteBoxPopup {
                          font-size: 13px;
                          font-weight: bold;
                      }
                  </style>
 
                                    <label>
                                        Type:
 
 
 
                 <asp:DropDownList ID="ddltype" runat="server" OnSelectedIndexChanged="ddltype_SelectedIndexChanged" DataSourceID="sdsCalFeulTypesNew" AutoPostBack="true" DataTextField="CalFeulTypeName" DataValueField="CalFeulTypeId">
 
                     <asp:ListItem Selected="True">Select ...</asp:ListItem>
 
 
 
 
                 </asp:DropDownList>
 
 
 
 
                                        <asp:SqlDataSource ID="sdsCalFeulTypesNew" runat="server"
                                            ConnectionString="<%$ ConnectionStrings:Connstr %>"
                                            SelectCommandType="StoredProcedure" SelectCommand="spGetAllCalType">
 
                                            <SelectParameters>
 
 
                                                <asp:Parameter Name="FeulCatFkey" Type="Int32" DefaultValue="1" />
 
 
                                            </SelectParameters>
 
                                        </asp:SqlDataSource>
 
 
 
 
 
 
                                        <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" CssClass="racSlide" Style="padding: 5px; margin: 5px; width: 70%;" Font-Bold="true"
                                            TextSettings-SelectionMode="Single" runat="server" DropDownWidth="240px"
                                            InputType="Text" DataSourceID="sdsCalculationName" DataTextField="CalculationName" DataValueField="Calculation_ID"
                                            EmptyMessage="Search Items" MinFilterLength="2" MaxResultCount="10" AllowTokenEditing="true"
                                            EnableClientFiltering="false" AllowCustomEntry="true"
                                            AutoPostBack="false" EnableAjaxSkinRendering="False" EnableTextSelection="True"
                                            EnableAriaSupport="True" Filter="StartsWith">
                                        </telerik:RadAutoCompleteBox>
 
 
 
 
 
                                    </label>
 
 
 
 
 
                                    <div style="margin-top: 60px; margin-left: 10px;">
                                          
                                        <asp:Button runat="server" ID="btnCancel" CssClass="btn btn-danger" Text="Cancel" Style="margin-top: 5px;" />
                                          
                                        <asp:Button runat="server" ID="btnNewCalculation" CssClass="btn btn-info" OnClick="btnNewCalculation_Click" Text="Start Calculation" Style="margin-top: 5px;" ValidationGroup="VGCal" />
 
 
                                    </div>
 
                              
                                    <asp:SqlDataSource ID="sdsCalculationName" runat="server"
                                        ConnectionString="<%$ ConnectionStrings:Connstr %>"
                                        SelectCommandType="StoredProcedure" SelectCommand="spGetAllCalculationName">
                                        <SelectParameters>
 
 
                                            <asp:Parameter Name="dep" Type="int16" DefaultValue="1" />
 
                                        </SelectParameters>
                                    </asp:SqlDataSource>
                          
                        </ContentTemplate>
 
                                  
                    </telerik:RadWindow>
 
    </Windows>
0
Doncho
Telerik team
answered on 13 Mar 2020, 03:24 PM

Hi,

The error message you are experiencing occurs due to the limitation of the RadWindowManager. This is also mentioned in the Cannot unregister UpdatePanel with ID 'UpdatePanelID' since it was not registered with the ScriptManager error.

There are two options for you to handle this problem.

Option 1

Mark-up

<telerik:RadWindow ID="RadWindow1" runat="server" Modal="true">
    <ContentTemplate>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <telerik:RadButton runat="server" ID="RadButton3" OnClick="RadButton3_Click"
                    Text="Postback" AutoPostBack="true" />
                <telerik:RadLabel runat="server" ID="RadLabel1"></telerik:RadLabel>
            </ContentTemplate>
        </asp:UpdatePanel>
    </ContentTemplate>
</telerik:RadWindow>

JavaScript

function onClientClicked(sender, args) {
    var wndw = $find("<%= RadWindow1.ClientID %>");
    wndw.show();
}

 

Option 2

Mark-up

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadButton3">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadLabel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    <Windows>
        <telerik:RadWindow ID="RadWindow1" runat="server" Modal="true">
            <ContentTemplate>
                <telerik:RadButton runat="server" ID="RadButton3" OnClick="RadButton3_Click"
                    Text="Postback" AutoPostBack="true" />
                <telerik:RadLabel runat="server" ID="RadLabel1"></telerik:RadLabel>
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

JavaScript for the button to open the window

function onClientClicked(sender, args) {
    var wndw = $find("<%= RadWindow1.ClientID %>");
    wndw.show();
}

Server-side code to update the label

protected void RadButton3_Click(object sender, EventArgs e)
{
    RadLabel1.Text = DateTime.Now.TimeOfDay.ToString();
}

Regards,
Doncho
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
Window
Asked by
Rebeen
Top achievements
Rank 1
Iron
Answers by
Rebeen
Top achievements
Rank 1
Iron
Doncho
Telerik team
Share this question
or