Iosu Buenetxea
Top achievements
Rank 1
Iosu Buenetxea
asked on 03 Apr 2008, 03:07 PM
Hi
I'm trying to do a postBack when the RadCombobox has closed, I want to do a postBack on client event OnClientDropDownClosing. I need to do a server event or a function in server side when the client side function has fired.
Best Regards.
I'm trying to do a postBack when the RadCombobox has closed, I want to do a postBack on client event OnClientDropDownClosing. I need to do a server event or a function in server side when the client side function has fired.
Best Regards.
9 Answers, 1 is accepted
0
Hello JUAN CRESPO,
One option would be to do a callback from the OnClientDropDownClosing event handler by using the RadAjaxManger functionality (more information on the approach here). This way you could avoid the actual postback.
On the other hand, if you wish to do a postback after the drop down has closed, you could use another approach: create an invisible asp Button which has its OnClick event handler on the server; hook to the OnClientDropDownClosed client event of the RadComboBox control and call the afore-mentioned button's click function, which will trigger the server-side event.
I hope this information is useful.
Sincerely yours,
Simon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
One option would be to do a callback from the OnClientDropDownClosing event handler by using the RadAjaxManger functionality (more information on the approach here). This way you could avoid the actual postback.
On the other hand, if you wish to do a postback after the drop down has closed, you could use another approach: create an invisible asp Button which has its OnClick event handler on the server; hook to the OnClientDropDownClosed client event of the RadComboBox control and call the afore-mentioned button's click function, which will trigger the server-side event.
I hope this information is useful.
Sincerely yours,
Simon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Iosu Buenetxea
Top achievements
Rank 1
answered on 07 Apr 2008, 07:28 AM
Hello Simon
I don't know which of the two options is the best, I'm going to explain you what I want to do.
I add dinamically my radCombos in the page, in each of then I want to execute a server function on onClientDropDownClosing, and I need to catch the RadCombo that execute the call on the server.
What is the best options to do this? and How can I do this?
Best regards.
I don't know which of the two options is the best, I'm going to explain you what I want to do.
I add dinamically my radCombos in the page, in each of then I want to execute a server function on onClientDropDownClosing, and I need to catch the RadCombo that execute the call on the server.
What is the best options to do this? and How can I do this?
Best regards.
0
Accepted
Hello JUAN CRESPO,
I suggest that you try the second approach: use a specific helper button which will do a postback on the server when a specific RadComboBox's DropDown closes.
The main advantage of this approach is that you could use different buttons for different RadComboBoxes which will ensure that you know on the server which RadComboBox's DropDown has closed.
Please find attached a sample project which illustrates the described above. Please download it and give it a go.
I hope it meets your requirements.
All the best,
Simon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I suggest that you try the second approach: use a specific helper button which will do a postback on the server when a specific RadComboBox's DropDown closes.
The main advantage of this approach is that you could use different buttons for different RadComboBoxes which will ensure that you know on the server which RadComboBox's DropDown has closed.
Please find attached a sample project which illustrates the described above. Please download it and give it a go.
I hope it meets your requirements.
All the best,
Simon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Ashley Green
Top achievements
Rank 1
answered on 29 Jul 2009, 09:44 PM
Hello,
I'm trying to achieve the following: if the selection of the drop down has not changed, do not postBack. if the selection has changed, do postBack. How would I achieve this? I tried to change OnClientDropDownClosing to OnClientSelectedIndexChanged but the OnClientSelectedIndexChanged event was not fired.
I'm using version 2009.2.701.35. My sample code is as below. Thanks for your help!
Thanks,
Ashley
I'm trying to achieve the following: if the selection of the drop down has not changed, do not postBack. if the selection has changed, do postBack. How would I achieve this? I tried to change OnClientDropDownClosing to OnClientSelectedIndexChanged but the OnClientSelectedIndexChanged event was not fired.
I'm using version 2009.2.701.35. My sample code is as below. Thanks for your help!
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title>Untitled Page</title> |
<style type="text/css"> |
.Hidden |
{ |
visibility: hidden; |
} |
</style> |
</head> |
<body> |
<script type="text/javascript"> |
function checkboxClick(e) |
{ |
e.cancelBubble = true; |
if (e.stopPropagation) |
{ |
e.stopPropagation(); |
} |
} |
function OnClientDropDownClosing(sender) |
{ |
document.getElementById(sender.get_id() + "Helper").click(); |
} |
</script> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server" /> |
<div> |
<telerik:RadComboBox runat="server" ID="RadComboBox1" Height="200" HighlightTemplatedItems="true" |
AutoPostBack="false" AllowCustomText="true" Text="All"> |
<Items> |
<telerik:RadComboBoxItem Text="One" /> |
<telerik:RadComboBoxItem Text="Two" /> |
<telerik:RadComboBoxItem Text="Three" /> |
</Items> |
<ItemTemplate> |
<div> |
<asp:CheckBox onclick="checkboxClick(event);" runat="server" ID="CheckBox" Text="" /> |
<%# DataBinder.Eval(Container, "Text") %> |
</div> |
</ItemTemplate> |
</telerik:RadComboBox> |
<asp:Button ID="RadComboBox1Helper" runat="server" Text="" CssClass="Hidden" OnClick="ButtonHelper_Click" /> |
</div> |
</form> |
</body> |
</html> |
using System; |
using System.Web.UI; |
public partial class _Default : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!IsPostBack) |
{ |
RadComboBox1.DataBind(); |
RadComboBox1.OnClientDropDownClosing = "OnClientDropDownClosing"; |
//RadComboBox1.OnClientSelectedIndexChanging = "OnClientDropDownClosing"; |
} |
Page.Title = "new title"; |
} |
#region DropDown Closed Events |
protected void ButtonHelper_Click(object sender, EventArgs e) |
{ |
RadComboBox1.Text = "13"; |
} |
#endregion |
} |
Thanks,
Ashley
0
Hello Ashley Green,
The code you provided works perfectly for me. When the dropdown is closed the ButtonHelper_Click is fired and the Text of the combo is changed.
Kind regards,
Veselin Vasilev
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.
The code you provided works perfectly for me. When the dropdown is closed the ButtonHelper_Click is fired and the Text of the combo is changed.
Kind regards,
Veselin Vasilev
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
Ashley Green
Top achievements
Rank 1
answered on 30 Jul 2009, 05:18 PM
Thanks Veselin for the reply. My question was that when the drop down is closed, but the selection of the drop down has not been changed, don't click the button. How would I achieve that? Thanks!
0
Hello Ashley Green,
In this case I suggest that you move your code to the OnClientSelectedIndexChanged event instead of the OnCliendDropDownClosin. That event will fire only after the selected item has been changed.
Kind regards,
Veselin Vasilev
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.
In this case I suggest that you move your code to the OnClientSelectedIndexChanged event instead of the OnCliendDropDownClosin. That event will fire only after the selected item has been changed.
Kind regards,
Veselin Vasilev
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
Marie
Top achievements
Rank 1
answered on 17 Sep 2014, 07:32 PM
Hi,
I tried this and is not working fine and no errors.
If I open the box and I select something and close, nothing. The button doesn't work.
After that I open and I close without touch anything and voila... the button works!
I had to add the code ClientIDMode="Static" because without this, doesn't work...
I'm using the new Telerik 2014.
We have the old one and no problem, but with the new Telerik UI AJAX is not working fine...
Any suggestions?
Thanks
function OnClientDropDownClosing(sender) {
document.getElementById(sender.get_id() + "Helper").click();
}
<telerik:RadComboBox ID="rcbProdGroup" runat="server" AutoPostBack="true" ClientIDMode="Static"
EmptyMessage="-All-" CheckBoxes="true" OnClientDropDownClosing="OnClientDropDownClosing"
DropDownAutoWidth="Enabled" EnableVirtualScrolling="true" >
</telerik:RadComboBox>
<asp:Button ID="rcbProdGroupHelper" runat="server" onclick="rcbProdGroupHelper_Click" ClientIDMode="Static"
Text="Get Item Ids" />
I tried this and is not working fine and no errors.
If I open the box and I select something and close, nothing. The button doesn't work.
After that I open and I close without touch anything and voila... the button works!
I had to add the code ClientIDMode="Static" because without this, doesn't work...
I'm using the new Telerik 2014.
We have the old one and no problem, but with the new Telerik UI AJAX is not working fine...
Any suggestions?
Thanks
function OnClientDropDownClosing(sender) {
document.getElementById(sender.get_id() + "Helper").click();
}
<telerik:RadComboBox ID="rcbProdGroup" runat="server" AutoPostBack="true" ClientIDMode="Static"
EmptyMessage="-All-" CheckBoxes="true" OnClientDropDownClosing="OnClientDropDownClosing"
DropDownAutoWidth="Enabled" EnableVirtualScrolling="true" >
</telerik:RadComboBox>
<asp:Button ID="rcbProdGroupHelper" runat="server" onclick="rcbProdGroupHelper_Click" ClientIDMode="Static"
Text="Get Item Ids" />
0
Hi Marie,
My suggestion is to use the controls server side events.
Regards,
Peter Filipov
Telerik
My suggestion is to use the controls server side events.
Regards,
Peter Filipov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.