RadPrompt + Open New Page

4 posts, 0 answers
  1. Arindam
    Arindam avatar
    28 posts
    Member since:
    Mar 2009

    Posted 18 May 2009 Link to this post

    Hi Friends -

    I am using radprompt in my program, what I want to achieve is that I want to call a page (lets say http://www.google.com) whenever a its getting opened.

    The purpose is that I dragged and dropped a node from my treeview, a radwindow get opened (radwindow is showing a report), whenever a reload button clicked in radwindow, a paramter page should get opened, for that reason I am using RadPrompt, I want to open a parameter page whenver a user click on the reload button of report.

    Please help...

    Thanks
    Arindam Roy
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 19 May 2009 Link to this post

    Hi Arindam,

    To fire an event using the Reload button we use the OnClientCommand event from the RadWindowManager. I have implemented  a sample method called OnClientCommand(sender, eventArgs) to be executed when the OnClientCommand (in the RadWindowManager) event is fired, and I think would help you achieve the things you have described in the ticket. This is the source code of the method:

    <script type="text/javascript"
            function OnClientCommand(sender, eventArgs) { 
                function promptCallBackFn(arg) { 
                    sender.setUrl("http://www.google.bg/search?&q=" + arg); 
                } 
                if (eventArgs.get_commandName() == "Reload") { 
                    eventArgs.set_cancel(true); 
                    radprompt('Please enter a string to search.', promptCallBackFn, 330, 100, null, 'Search', 'Telerik'); 
                } 
            } 
            function OnClientNodeDropping(sender, args) { 
                var xPos = args.get_domEvent().offsetX; 
                var yPos = args.get_domEvent().offsetY; 
                var oWnd = radopen("http://www.google.com", "RadWindow1"); 
                oWnd.moveTo(xPos, yPos); 
     
            } 
        </script> 

    I have put the CallBackFunction of the radprompt inside the OnClientCommand(sender, eventArgs), because I assumed that when you call the radprompt Dialog you will enter parameters that would be send back to the initial RadWindow (I guess you want to update the info on the report).In order not to search for the RadWindow in the CallBackFunction (if it is outside the OnClientCommand method) we have it as sender object OnClientCommand(sender, eventArgs).


    We also have to be sure that only the Reload button of the RadWindow is used to fire the event, as you may know that the OnClientCommand event is fired when all of the RadWindow buttons are clicked. This is ensured with the " if (eventArgs.get_commandName() == "Reload") " command. After we have set a different method to be executed when the Reload button is clicked we have to cancel the default method that is executed i.e. reload the content in the RadWindow (achieved with eventArgs.set_cancel(true); ).

    I have attached the example project I have implemented as an additional resource in case you might need it.


    Kind regards,
    Petre Lukarov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Arindam
    Arindam avatar
    28 posts
    Member since:
    Mar 2009

    Posted 20 May 2009 Link to this post

    Hi Petre,

    Thanks a lot for the source codes. It is really very helpful.

    The logic you explained is really what I needed, but with a little twist.

    radprompt('Please enter a string to search.', promptCallBackFn, 330, 100, null, 'Search', 'Telerik');
    in the above one I am only having one parameter.

    But I will be having more than one parameter and I need to show them in a single page
    , for e.g. if I am having one parameter Start Date and other one End Date, and I need to show them in one  prompt window itself, how can I achieve this functionality. And at the end both this parameter value will be passed to RadWindow that is opened. How can I do that?

    Please need help on this matter, if you have any queries do let me know.

    Thanks
    Arindam




  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 20 May 2009 Link to this post

    Hello Arindam,

    This functionality is not directly related to the RadWindow control. Please implement the desired functionality with a standard prompt dialog (window.prompt()) and when you have your code working as expected - just open a support ticket and send us your implementation. We will rework it for you so it uses radprompt.


    Regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top