I've been upgrading my combo from the standard radcontrols to Prometheus, but it's complaining in the client script that findItemValue doesn't exist.
Is there an alternative way to find an item in the combo based on either a value or text? I've had a look at the demos and documentation but couldn't find anything
Regards
Bobby
4 Answers, 1 is accepted
The names of the javascript methods are: findItemByValue and findItemBytext.
I suggest you check the following article:
Migrating RadComboBox Classic to RadComboBox Prometheus
Hope this helps.
Greetings,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Still no luck. Below is some sample code. It throws an "object doesn't support this property or method" exception when it tries to call the "findItemByValue" method.
================ASPX START======================
<%
@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" 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>
</
head>
<
body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<telerik:RadComboBox ID="RadComboBox2" runat="server" AutoPostBack="true" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">
<Items>
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
<ExpandAnimation Type="OutQuart" />
</telerik:RadComboBox>
</form>
<script language="javascript" type="text/javascript" >
function
OnClientSelectedIndexChanged(o,eventargs)
{
var rcbCombo = document.getElementById("<%= RadComboBox2.ClientID %>");
var rciComboItem = rcbCombo.findItemByValue("Text2");
}
</
script>
</
body>
</
html>
================ASPX END ======================
================VB START======================
Imports
Telerik.Web.UI
Imports
Telerik.WebControls
Partial
Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
RadComboBox2.Items.Add(
New RadComboBoxItem("Text1", "Value1"))
RadComboBox2.Items.Add(
New RadComboBoxItem("Text2", "Value2"))
End Sub
End
Class
================VB END======================
You should obtain a reference to the ComboBox using this syntax:
| var rcbCombo = $find("<%= RadComboBox2.ClientID %>"); |
instead of
var rcbCombo = document.getElementById("<%= RadComboBox2.ClientID %>");
I think you may find useful the help topics under Controls / RadComboBox / RadComboBox Client-Side /
Kind regards,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Works fine now. Cant believe I didn't find that in the help file.
Thanks for your prompt responses.
Regards
Bobby