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

radconfirm

5 Answers 412 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jorge
Top achievements
Rank 1
Jorge asked on 12 Nov 2008, 12:10 AM
Hi, used the follow code to call radconfir:
 
System.Web.UI.ScriptManager.RegisterClientScriptBlock(UpdatePanel1, Me.GetType(), "SCRIPT""confirmSaveDuplicatePerson()"True

and i used the javascript code
function confirmSaveDuplicatePerson() 
radconfirm('Are you sure?',confirmSaveCallback,330,100,null,'Duplicate'); 

How can I know the value of the result. I want to doing this:

if result=true then
msgbox("true")
'call some function
else
msgbox("false"
end if

I read in other post that you can know the value but in the javascript function and from there doing something, but i need know the value but in my VB code.

Thanks




5 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Nov 2008, 09:18 AM
Hi Jorge,

Radconfirm just as the standard confirm works on the client. Therefore, to perform any actions on the server side after you select Yes/No, you need to make a postback to the server.

You can do this by placing an invisible server button on your page and then in the JavaScript callback function of radconfirm to invoke the "click" event of the button which will cause a postback. Then, in the event handler of the button you can perform the server side actions. Try the code snippets below.

ASPX:
    <style type="text/css">  
    .buttons  
    {  
        display:none  
    }  
    </style>  
<asp:Button ID="Button1" CssClass="buttons" runat="server" onclick="Button1_Click" Text="Button" />
 
<asp:Button ID="Button2" CssClass="buttons" runat="server" onclick="Button2_Click" Text="Button" /> 
 
 
<script language="javascript" type="text/javascript">  
function confirmSaveDuplicatePerson()   
{   
    radconfirm('Are you sure?',confirmCallBackFn,330,100,null,'Duplicate');   
}   
function confirmCallBackFn(arg)  
{  
    if(arg == true)  
        {  
            document.getElementById("Button1").click();  
        }  
    if(arg == false)  
        {  
            __doPostBack("<%= Button2.ClientID %>","");    
        }  
}  
</script>  

VB:
Protected Sub Button1_Click(ByVal sender As ObjectByVal e As EventArgs) 
    'Result is "True" 
    'Call some function 
End Sub 
 
Protected Sub Button2_Click(ByVal sender As ObjectByVal e As EventArgs) 
    'Result is "False" 
    'Call some function 
End Sub 

Regards,
Shinu.
0
Jorge
Top achievements
Rank 1
answered on 12 Nov 2008, 03:00 PM
You all right Shinu.

Thanks for your help.
0
waruni
Top achievements
Rank 1
answered on 05 Jul 2009, 06:51 PM
Hi,

This is not work for me, I'm using master page,
so it doesn't call a button events,
can you please send us a sample.


Thanks
0
Georgi Tunev
Telerik team
answered on 06 Jul 2009, 07:13 AM
Hi waruni,

If you are using MasterPage in this scenario, you should use the ClientID of the control:
function confirmCallBackFn(arg)   
{   
    if(arg == true)   
        {   
            document.getElementById("<%= Button1.ClientID %>").click();   
        }   
    if(arg == false)   
        {   
            __doPostBack("<%= Button2.ClientID %>","");     
        }   
}   



Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
waruni
Top achievements
Rank 1
answered on 06 Jul 2009, 02:41 PM
Hi,

Thanks for quick response. Its works  :)

Thanks for your help.
Tags
Window
Asked by
Jorge
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jorge
Top achievements
Rank 1
waruni
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or