Restrict postbak from client side

5 posts, 2 answers
  1. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 05 Jun 2010 Link to this post

    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
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Jun 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 07 Jun 2010 Link to this post

    thanks friend i thought about this idea but checked if any other solution is avaialble or not?
  5. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 07 Jun 2010 Link to this post

    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.
  6. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 07 Jun 2010 Link to this post

    thjanks admin i used princy solution. i read the article you gave that also nice
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017