BTW I tried OnClientTextChange event too and it is also unreliable. It does not get raised in every situation.
4 Answers, 1 is accepted
u can set your rabcombobox AutoPostBack property to true value, i think it will be ok.
AutoPostBack="true"
if it still not working, can u show your source code so that we can discuss and resolve it easier?
best regards.
Here is the script in the page.
function testEvent(sender, eventArgs) {
var combo = $find('Customer');
alert(combo.get_value() + " : " + combo.get_text());
}
Here is the control definition:
<telerik:RadComboBox ID="Customer" runat="server" Width="200px" DropDownWidth="405px" Height="225" OnClientSelectedIndexChanged="testEvent" HighlightTemplatedItems="true" ExpandAnimation-Duration="0" CollapseAnimation-Duration="0" EnableLoadOnDemand="true" EnableEmbeddedSkins="false" Skin="Vista">
<ItemTemplate>
<span style="width:50;overflow:hidden;white-space:nowrap;">
<%#DataBinder.Eval(Container.DataItem, "ID")%>
</span>
<span style="width:164;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-left:4;">
<%#DataBinder.Eval(Container.DataItem, "LastFirstName")%>
</span>
<span style="width:164;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-left:4;">
<%#DataBinder.Eval(Container.DataItem, "Address")%>
</span>
</ItemTemplate>
</telerik:RadComboBox>
and the code behind:
Protected Sub Customer_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs) Handles Customer.ItemsRequested
Dim strPrefixText As String = e.Text.Trim
If strPrefixText <> Nothing Then
With Me.Customer
.DataSource = DAL.GetReader(String.Format(
"SELECT Top 100 ID, LastFirstName, Address " &
"FROM CustomersView WHERE LastFirstName LIKE '{0}%' ORDER BY LastFirstName", DBQuoteFix(strPrefixText)))
.DataValueField = "ID"
.DataTextField = "LastFirstName"
.DataBind()
.DataSource.Close()
End With
End If
End Sub
How to reproduce the problem:
- Select an item from the list.
- Item gets selected and event is raised normally
- Now go to the end of the text and delete a few characters so that text no longer matches any items in the list
- No event is raised even though the client value and posted ID value has changed to blank
u change your script into the code i give bellow and it will be resolved.
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
function testEvent(sender, args) {
var combo = $find("<%= Customer.ClientID %>");
alert(combo.get_value() + " : " + combo.get_text());
}
</script>
</telerik:RadScriptBlock>
best regards.
var combo = $find("<%= Customer.ClientID %>");
And I have:
var combo = $find('Customer');
But both resolve to the same thing. My "Customer.ClientID" is "Customer". But I tried it anyway to make sure. No difference.
Again the problem is that the testEvent does not get raised by the control reliably not that it's content is not working. When it gets called it works fine. The event fails to be raised when the item is changed from one in the list to one that is no longer in the list. Please, read my last post again about how to reproduce this event fail.