Confirm Button

Thread is closed for posting
2 posts, 0 answers
  1. 2C36E8AF-85FA-41F6-87AB-424A9869CDE1
    2C36E8AF-85FA-41F6-87AB-424A9869CDE1 avatar
    27 posts
    Member since:
    May 2010

    Posted 21 Jun 2012 Link to this post

    Requirements

    RadControls version 2011.3.1115.35
    .NET version 3.5
    Visual Studio version 2010/2012 RC
    programming language C#
    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    Sometimes, You use a button for delete function with confirmation from the user. And you usually write some js function, but this will repeat your work at many pages, or you simply don't like that way. And sometime, it's not quite easy and convenient to localize strings in js function. For example: with the confirmation "Are you sure to delete?", you would like to localize it in various languages.

    I create a very simple button, which inherit RadButton, and a few lines of codes. You can set some properties in design-time to get the function you want to use.

    I create two properties (of course, you can name whatever you like):
    - CwIsConfirmButton: Default is "false", and the Button is just a normal RadButton. When set to "true", it becomes ConfirmButton, and you need to set the CwConfirmText as below.
    - CwConfirmText: is just like its name. The string like: Are you sure to delete?... And you can localize this text as you like.

    That's it. I think it's so simple but may be helpful.

    I suggest this would be a function of RadButton in the next version.
    Thank you for your awesome controls, Telerik.
  2. 82125995-D467-49DC-88FF-9544CC577B74
    82125995-D467-49DC-88FF-9544CC577B74 avatar
    1359 posts
    Member since:
    Jan 2017

    Posted 02 Jul 2012 Link to this post

    Hello,

    Thank you for the feature suggestion! This request is already logged in PITS and you can track its progress. The confirm button functionality will be considered for implementation, although I cannot provide a firm estimate when it will be incorporated in the RadButton.

    As for your sample, I have made several modifications, while keeping your base approach, in order to improve it.

    First of all, it is recommended to use the client-side click events of the RadButton control to implement the confirm dialog - OnClientClicking and OnClientClicked. In this case OnClientClicking will be more suitable, as it allows you to cancel the click event when the confirm dialog is canceled. I have used the OnInit event of the custom RadButton class in order to attach a handler to the OnClientClicking event.

    I also created a new web application that uses your code, as the project that you have attached required IIS 7.5 Express. This way the provided example can be downloaded and ran without additional changes.

    As a token of gratitude for the provided code library I have updated your telerik points accordingly.

    Kind regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.