This is a migrated thread and some comments may be shown as answers.

Rad Prompt And PostBack

4 Answers 240 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Lars Solberg
Top achievements
Rank 1
Lars Solberg asked on 06 May 2008, 03:22 PM
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.

4 Answers, 1 is accepted

Sort by
0
Accepted
Erjan Gavalji
Telerik team
answered on 06 May 2008, 04:02 PM
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
0
Lars Solberg
Top achievements
Rank 1
answered on 06 May 2008, 04:36 PM
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
0
Lars Solberg
Top achievements
Rank 1
answered on 06 May 2008, 05:05 PM
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
0
Accepted
Peter
Telerik team
answered on 07 May 2008, 08:01 AM
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
Tags
ToolBar
Asked by
Lars Solberg
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Lars Solberg
Top achievements
Rank 1
Peter
Telerik team
Share this question
or