Migrating from ModalPopupExtender to RadWindow

4 posts, 0 answers
  1. Chris
    Chris avatar
    15 posts
    Member since:
    Oct 2010

    Posted 18 Jan 2012 Link to this post

    Hi,

    Does anybody has an example on how to convert from the asp.net Toolkit ModalPopupExtender to the RadWindow control?
    Basically I have this code:

    <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/>
    

    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderAddEditSample" runat="server"                
    				TargetControlID="hiddenTargetControlForModalPopup"                
    				PopupControlID="PanelSamples"
    				BackgroundCssClass="modalBackground"                 
    				DropShadow="true"                                
    				>
    				</ajaxToolkit:ModalPopupExtender>       
    		<!-- modal popup -->
    		<asp:Panel ID="PanelSamples" runat="server" Style="displaynone" CssClass="modalPopup"> 
    			<asp:UpdatePanel ID="UpdatePanel1" runat="server">                
    				<ContentTemplate>
    				<!-- a bunch of controls and HTML -->
    				</ContentTemplate>            
    			</asp:UpdatePanel>
    
    		</asp:Panel>
    
    Is there an easy way to covert this code to a RadWindow? Thanks!
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Jan 2012 Link to this post

    Hello,

    Making RadWindow as modal is nearly simple by setting the "Modal" property to "True".

    <telerik:RadWindow ID="RadWindow 1" runat="server"  Modal="true">

    Also take a look into this for more.

    Thanks,
    Princy.
  3. Chris
    Chris avatar
    15 posts
    Member since:
    Oct 2010

    Posted 20 Jan 2012 Link to this post

    Princy:

    Thank you for your prompt answer. the problem I'm having now is that my popup requires to be opened after a click event on a linkbutton control. With my current code, in order to show the popup, all I had to do was to call this:

    this.ModalPopupExtenderAddEditSample.Show();
    

    RadWindow does not seem to have any equivalent method. Is the only way to achieve that by hooking to the clientScript the javascript code?
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5243 posts

    Posted 23 Jan 2012 Link to this post

    Hello Chris,

    The RadWindow is a client-side object and thus must be shown via JavaScript. You can use the LinkButton's OnCilentClick event to open the Radwindow and cancel the postback (if it is only an AJAX request that will not dispose the RadWindow you may not cancel it), for example:
    <asp:LinkButton ID="Linkbutton1" Text="some text" OnClientClick="JsFunctionToOpenTheRadWindow(); return false;"  runat="server" />

    Please also examine this help article on the ways to open a RadWindow: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html. If you explicitly need to do this from the server please examine this thread: http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx.

    I believe examining the Client-side API of the RadWindow will also be helpful: http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html.

    Kind regards,
    Marin
    the Telerik team
    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 their blog feed now
Back to Top