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

Restrict postbak from client side

4 Answers 60 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Akhil Raj
Top achievements
Rank 1
Akhil Raj asked on 05 Jun 2010, 11:08 AM
hi
  i am using radtoolbar with 2 buttons to close and save the page values. I used one client side function to ask confirmation to the user when save button pressed. For this i added attributes to the onclick event. but when i click cancel in the confirm box also the page postbak or the button function working.

I cant call client side event of radtoolbar because i need to pass the confirm mesage from the code behind. So how can i achieve using this way
            function getConfirm(message) {  
                if (confirm(message) != true) {  
                    return false;  
                }  
                return true;  
            } 

this is my javascript function please tell me how can i restrict to call my code behind funtion

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 05 Jun 2010, 01:40 PM
Hello Akhil,

You can attach "OnClientButtonClicking" event to RadToolBar and execute set_cancel(true) in order to cancel the event based on the confirm return value.

Use an HiddenField control for passing the message from server code to client.

Regards,
Princy.
0
Akhil Raj
Top achievements
Rank 1
answered on 07 Jun 2010, 05:18 AM
thanks friend i thought about this idea but checked if any other solution is avaialble or not?
0
Accepted
Yana
Telerik team
answered on 07 Jun 2010, 07:48 AM
Hello Akhil,

Please check this kb article which explains similar approach.

Regards,
Yana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Akhil Raj
Top achievements
Rank 1
answered on 07 Jun 2010, 08:53 AM
thjanks admin i used princy solution. i read the article you gave that also nice
Tags
ToolBar
Asked by
Akhil Raj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Akhil Raj
Top achievements
Rank 1
Yana
Telerik team
Share this question
or