4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 13 Nov 2008, 01:30 PM
Hi Sreenivas,
Please try the below code snippets to produce RadConfirm window from server side. Also make sure that the "AutoPostBack" property of RadComboBox set to true. You can check the return value on client side.
C#:
JavaScript:
You can check the forum link below, which dicusses on how to handle Confirm window result on server side.
RadConfirm on server side
Thanks,
Princy.
Please try the below code snippets to produce RadConfirm window from server side. Also make sure that the "AutoPostBack" property of RadComboBox set to true. You can check the return value on client side.
C#:
| protected void RadComboBox1_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) |
| { |
| string radconfirmscript = "<script language='javascript'> Sys.Application.add_load(function(){radconfirm('Click Ok to continue...</b>!',confirmCallBackFn);})</script>"; |
| Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radconfirmscript); |
| } |
JavaScript:
| <script language="javascript" type="text/javascript"> |
| function confirmCallBackFn(arg) |
| { |
| if(arg == true) |
| { |
| //Clicked OK |
| } |
| if(arg == false) |
| { |
| //Clicked Cancel |
| } |
| } |
| </script> |
You can check the forum link below, which dicusses on how to handle Confirm window result on server side.
RadConfirm on server side
Thanks,
Princy.
0
[Nean]
Top achievements
Rank 1
answered on 31 Mar 2009, 01:26 PM
Hi Princy,
This is interesting and it's clos to what i'm looking for. But I have one question : How can we call a server-side function if the user click "yes" ? And another question : How can we show a radconfrim only for some items of the RadComboBox ?
Thanks in advance.
[Nean]
This is interesting and it's clos to what i'm looking for. But I have one question : How can we call a server-side function if the user click "yes" ? And another question : How can we show a radconfrim only for some items of the RadComboBox ?
Thanks in advance.
[Nean]
0
Shinu
Top achievements
Rank 2
answered on 01 Apr 2009, 06:46 AM
Hi Nean,
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 invisible server buttons 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.
CSS:
ASPX:
CS:
JavaScript:
As an alternative you can also perform an ajax request instead of using __doPostBack javaScrip built-in function. You can do this by using the RadAjaxManager control and its ajaxRequest function .
Thanks,
Shinu.
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 invisible server buttons 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.
CSS:
| <style type="text/css"> |
| .button |
| { |
| display: none; |
| } |
| </style> |
ASPX:
| <telerik:radcombobox id="RadComboBox1" AutoPostBack="true" runat="server" EnableScreenBoundaryDetection="False" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"> |
| <Items> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="RadComboBoxItem1"></telerik:RadComboBoxItem> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2"></telerik:RadComboBoxItem> |
| <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" Value="RadComboBoxItem3"></telerik:RadComboBoxItem> |
| </Items> |
| </telerik:radcombobox> |
| <asp:Button ID="Button1" CssClass="button" runat="server" OnClick="Button1_Click" Text="Button" /> |
| <asp:Button ID="Button2" CssClass="button" runat="server" OnClick="Button2_Click" Text="Button" /> |
CS:
| protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
| { |
| if (e.Text == "RadComboBoxItem1" || e.Text == "RadComboBoxItem2") // Check for condion - RadConfirm for selelected tems only |
| { |
| string radconfirmscript = "<script language='javascript'> Sys.Application.add_load(function(){radconfirm('Click Ok to continue...</b>!',confirmCallBackFn);})</script>"; |
| Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radconfirmscript); |
| } |
| } |
| protected void Button1_Click(object sender, EventArgs e) |
| { |
| Response.Write("Clicked OK"); // Clicked OK |
| } |
| protected void Button2_Click(object sender, EventArgs e) |
| { |
| Response.Write("Clicked Cancel"); // Clicked Cancel |
| } |
JavaScript:
| <script language="javascript" type="text/javascript"> |
| function confirmCallBackFn(arg) |
| { |
| if(arg == true) |
| __doPostBack('Button1',''); |
| if(arg == false) |
| __doPostBack('Button2',''); |
| } |
| </script> |
As an alternative you can also perform an ajax request instead of using __doPostBack javaScrip built-in function. You can do this by using the RadAjaxManager control and its ajaxRequest function .
Thanks,
Shinu.
0
[Nean]
Top achievements
Rank 1
answered on 01 Apr 2009, 07:39 AM
Hi Shinu,
Thanks for your answer. I will try that very soon (I'm on something else for the moment but when I saw this post I remenbered that I have the same problem).
Thanks again,
[Nean]
Thanks for your answer. I will try that very soon (I'm on something else for the moment but when I saw this post I remenbered that I have the same problem).
Thanks again,
[Nean]