Community & Support
Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ToolBar > Rad Prompt And PostBack

Answered Rad Prompt And PostBack

Feed from this thread
  • Lars Solberg avatar

    Posted on May 6, 2008 (permalink)

    I have a Toolbar with about 7 buttons, half of which need postbacks and the others don't.  I attached an OnClientButtonClicking event with a switch statement to set up the appropriate actions and a ButtonClick event for the server actions.  One of the buttons launches a radprompt but it doesn't wait for the response before it does the postback.  I tried to manually trigger the postback by doing this:
    ...
    case 4:
    radprompt('Reasons for Reject:', promptCallBackFn, 330, 100, null,'Reject');
    args.set_cancel(true);
    Break;
    ...

    function

    promptCallBackFn(arg){

    <%= Page.GetPostBackEventReference(RadToolBar1) %>}

    but it gave me an error saying the input string was not in the correct format.


    Any help would be greatly appreciated, Thank you.

    Reply

  • Answer Erjan Gavalji Erjan Gavalji admin's avatar

    Posted on May 6, 2008 (permalink)

    Hi Lars Solberg,

    Using radconfirm to determine if to cancel a postback event handler is a bit tricky. This comes as the radconfirm function does not stop the code execution as the browser alert/confirm functions do.

    That's why some JavaScript tricks should be used. Such a trick is to:
    • stop the click event
    • call the radconfirm function
    • call the item click to make the postback depending on the result.
    To my regret this trick includes the usage of the private _onClick method of the RadToolBarButton client-side object. We will improve the client-side API of the latter for the first service pack of the suite.

    Please, find attached a sample page demonstrating this approach.

    Let me know if that helps.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Lars Solberg avatar

    Posted on May 6, 2008 (permalink)

    Thanks for the quick response...Your solution worked well, but I still have one problem.  I'm trying to do this with a rad prompt instead of confirm, so I replaced your sample with a prompt.  The only thing i can't figure out is how to send the users response (args from the prompt) to the postback.

    Thanks again

    Reply

  • Lars Solberg avatar

    Posted on May 6, 2008 (permalink)

    I was able to get it working with a hidden field, but I'd rather do it with an eventarg if possible.

    Thanks so much

    Reply

  • Answer Peter Peter admin's avatar

    Posted on May 7, 2008 (permalink)

    Hi Lars,

    You can use the following code in the promptCallBack function:
    toolbar.trackChanges();  
    button.set_commandArgument(promptResult);  
    toolbar.commitChanges(); 

    Please, find attached the modified demo page which shows this approach in action.

    If there are any questions, please feel free to ask us.

    Erjan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
    Attached files

    Reply

  • Q1 Webinar Week

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ToolBar > Rad Prompt And PostBack
Related resources for "Rad Prompt And PostBack"

[   ASP.NET ToolBar Features  |  Documentation  |  Demos  |  Telerik TV   |   Self-Paced Trainer   |  Step-by-step Tutorial  ]