Radconfirm Problem when using RadButton

5 posts, 1 answers
  1. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 12 Jul 2012 Link to this post

    Hi,

           In my page I have to popup the radconfirm on a button click.  Depends upon the value return by radconfirm I have to perform some actions that is if it is false or null  then cancel the click event action. If it is true then I donot perform no operation because  i have written the server side button click event handling function so it will call. My problem is if i click button radconfirm is popuped and it doesnt wait for  the value return by the radconfirm it postbacks and perform the server side action.

    I checked the documentation in  following tutorial
    http://demos.telerik.com/aspnet-ajax/window/examples/confirmserverclicks/defaultcs.aspx,

    In this they are using ASP button  but I have to use radbutton. Please give a solution for this.

    Thanks
    Velkumar.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Jul 2012 Link to this post

    Hi Velkumar,

    The issue here is due to the postback from the RadButton. To solve this problem you could use the AutoPostBack property of the RadButton and set it to false and do the postback manually. Here is the sample code snippet that I tried.

    ASPX:
    <telerik:RadButton ID="RadButton1" runat="server" OnClientClicking="ConfirmButton" AutoPostBack="false" OnClick="RadButton1_Click">
    </telerik:RadButton>

    JS:
    <script type="text/javascript">
        function ConfirmButton(sender, eventargs) {
            function aspButtonCallbackFn(arg) {
                if (arg) {
                    __doPostBack("<%=RadButton1.UniqueID %>", "");
                }
                else {
                    eventargs.set_cancel(true);
                }
            }
            radconfirm("Are you sure you want to postback?", aspButtonCallbackFn, 330, 110, null, "Confirm");
        }
    </script>

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
     {
       RadWindowManager1.RadAlert("Postback from asp button on " + DateTime.Now.ToString(), 300, 110, "Action Result", null);
     }

    Hope this helps.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 13 Jul 2012 Link to this post

    Hi,

               It works fine. Thanks for  your help.


    Thanks
    Velkumar.
  5. Amit
    Amit avatar
    1 posts
    Member since:
    Sep 2012

    Posted 13 Nov 2012 Link to this post

    Hi,
    How do I tackle the same problem with silverlight.
    I have a RadButton control with a command.And I want to raise RadButton click event on few other actions through silverlight code.
    How do I do this.

    Thanks
    Amit
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 15 Nov 2012 Link to this post

    Hi Amit,

    I ask that you post your questions in the relevant forum, because this is the ASP.NET AJAX Forum and not the Silverlight one. The two technologies are fundamentally different and the people there will be able to help you better: http://www.telerik.com/community/forums/silverlight/buttons.aspx. I also advise that you explain your case in more detail when you post your question there, as it is not completely clear what you want to achieve and which events you need to fire and under what conditions.


    Greetings,
    Marin Bratanov
    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
UI for ASP.NET Ajax is Ready for VS 2017