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

Radconfirm Problem when using RadButton

4 Answers 169 Views
Window
This is a migrated thread and some comments may be shown as answers.
Velkumar
Top achievements
Rank 2
Velkumar asked on 12 Jul 2012, 01:44 PM
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.

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 13 Jul 2012, 04:37 AM
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.
0
Velkumar
Top achievements
Rank 2
answered on 13 Jul 2012, 07:15 AM
Hi,

           It works fine. Thanks for  your help.


Thanks
Velkumar.
0
Amit
Top achievements
Rank 1
answered on 13 Nov 2012, 04:33 PM
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
0
Marin Bratanov
Telerik team
answered on 15 Nov 2012, 02:04 PM
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.
Tags
Window
Asked by
Velkumar
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Velkumar
Top achievements
Rank 2
Amit
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or