directing page loading with radwindow

2 posts, 0 answers
  1. Leonard
    Leonard avatar
    6 posts
    Member since:
    Dec 2011

    Posted 14 Dec 2011 Link to this post

    Hello!

    I have inherited an asp.net project that relies heavily on the Telerik library.  In the current application, there are two menu items that when clicked generate a redirect to the same asp page, but with different arguments:
    ~\myasppage.aspx?Mode="A"&Type="B";
    ~\myasppage.aspx?Mode="C"&Type="D";

    So I have been asked to replace them with a dialog box that allows the user to choose the Mode and type, then opening the page.  In looking at the Telerik controls that are available to me, it seems that the RadWindow is perfect.  My strategy is:
    redirect to the generic page:
    ~\myasppage.aspx
    Define a RadWindow on the page and sets its VisibleOnPageLoad to true.

    The RadWindows contains a Cancel button and a Next button.  Selection of the cancel button closes the dialog and leaves an empty page.  Selection of the Next button will redirect to the same page but contain the Mode and Type parameters using the
     window.location = myasppage.aspx?Mode="whatever"&Type="whatever";

    My problem is that because VisibleOnPageLoad=true the radwindow always opens so  I can't load the real page! 

    Am I going about this correctly? Is there another control to deal with this? 

    I was thinking that I could set VisibleOnPageLoad to false, then check for my parameters in the OnPreInit method to decide if I should show the radwindow. 

    I haven't been able to figure out how to call a javascript function (to show the radwindow) from the code behind, and even if I could, I'm not sure that the javascript would even be loaded yet!

    Is there a better way of doing this?  Will this even work?

    thanks

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4526 posts

    Posted 16 Dec 2011 Link to this post

    Hello Leonard,

    I believe checking for the presence of these parameters in the querystring is a good approach to determining whether you should show the RadWindow. What I can suggest is that you open it from the server by using the approach from the following sticky thread: http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx. Please note the utilization of the Sys.Application.Load event which guarantees that all necessary scripts are loaded on the page before trying to show the RadWindow.


    Best wishes,
    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