Rad Prompt And PostBack

5 posts, 2 answers
  1. Lars Solberg
    Lars Solberg avatar
    22 posts
    Member since:
    Apr 2008

    Posted 06 May 2008 Link to this post

    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.

  2. Answer
    Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 06 May 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lars Solberg
    Lars Solberg avatar
    22 posts
    Member since:
    Apr 2008

    Posted 06 May 2008 Link to this post

    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
  5. Lars Solberg
    Lars Solberg avatar
    22 posts
    Member since:
    Apr 2008

    Posted 06 May 2008 Link to this post

    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
  6. Answer
    Peter
    Admin
    Peter avatar
    6637 posts

    Posted 07 May 2008 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017