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

Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.

1 Answer 432 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Web
Top achievements
Rank 1
Web asked on 02 Jun 2008, 11:46 AM
I am using Q1 2008 and have a form using multiple rad controls and rad windows.  When I add the PromptTemplate with a rad control to my window manager, I get the following error:

Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Here is my code as copied from (
http://www.telerik.com/support/kb/article/b454K-hbc-b454T-cec-b454c-cec.aspx
and
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Window/Examples/BrowserDialogBoxes/DefaultCS.aspx):

If I remove both telerik controls, no error; but if I place either control then I get the page cannot be null error.

<telerik:RadWindowManager ID="RadWindowManager1" runat="server"   
    Skin="Mac" Modal="true" VisibleStatusbar="false" VisibleOnPageLoad="false" 
    ReloadOnShow="true" ShowContentDuringLoad="false">  
    <PromptTemplate> 
        <script type="text/javascript">  
            function closePrompt()  
            {  
                var select = document.getElementById('select');  
                var selectselectselectedValue = select.options[select.selectedIndex].value;  
                GetRadWindow().ModalDialogCallBack(selectedValue);  
            }  
        </script> 
          
        <style type="text/css">  
            .Button      
            {      
                background: url({2}Img/modalBtnBg.gif) no-repeat; border: 0px; width: 78px; height: 20px; color: #333; font: normal 11px Verdana,Arial, Sans-serif; margin: 2px;  
            }   
            .FixedDiv      
            {      
                font: normal 11px Verdana, Arial,Sans-serif;      
                margin: 3px;      
                color: black;      
                text-align: center;      
            }      
        </style>    
        <div class='FixedDiv'>     
            <center> 
                <br />    
                <img align="absmiddle" style='vertical-align: middle; border: 0' src='{2}Img/AlertIcon.gif' /> 
                Please enter your password:  
                <br /> 
                <telerik:RadTextBox ID="userPassword" runat="server" MaxLength="50" 
                    TextMode="Password" Skin="Mac" EnableEmbeddedSkins="false"   
                    SelectionOnFocus="SelectAll">  
                </telerik:RadTextBox> 
                <br /> 
                <br /> 
                Please select your domain:  
                <telerik:RadComboBox ID="userDomain" runat="server"   
                    DropDownWidth="100px" RadComboBoxImagePosition="Right"   
                    Skin="Mac" Width="100px" EnableEmbeddedScripts="true"   
                    ToolTip="Select a domain." 
                    > 
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                    <ExpandAnimation Type="OutQuart"></ExpandAnimation> 
                    <Items> 
                        <telerik:RadComboBoxItem Text="DOMAIN1" Value="DOMAIN1" /> 
                        <telerik:RadComboBoxItem Text="DOMAIN2" Value="DOMAIN2" Selected="true" /> 
                    </Items> 
                </telerik:RadComboBox> 
                <br /> 
                <br /> 
                <button class="Button" onclick="closePrompt()">OK</button> 
                <button class="Button" onclick="GetRadWindow().Close()">Cancel</button> 
            </center>    
        </div>    
    </PromptTemplate> 



1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 03 Jun 2008, 01:34 PM
Hello Web,

The reason for this problem is that you are trying to put a server control like RadComboBox in the prompt template while this template accepts only pure HTML - as it is shown in the KB article. If you want to use RadComboBox for this purpose, I would suggest to put it in a separate page which will be loaded in a RadWindow - this way you will get the same result.

More information on how to use RadWindow as a dialog and how to send and receive arguments from a content page is available in our demos and in the documentation, section Programming / Using RadWindow as a Dialog.



Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Web
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or