Hello, all
I'm trying to tie into the OnClientKeyPressed event of the RadCombobox (really wished you had an onclientkeyup event, but...). My RadCombobox is in a grid, which makes it difficult to assess its ClientID. I've been scouring through the Client-Side-API, which implies I could just reference the ClientID, or the ID, however both of these are returning "undefined". Since it is an OnKeyPressed event, I could just set a reference to the control, and then do some jquery to tie into the OnKeyUp event on client-side, but this seems "hacky". I wanted to know if there is a more "blessed" solution. My code is as follows:
I'm trying to tie into the OnClientKeyPressed event of the RadCombobox (really wished you had an onclientkeyup event, but...). My RadCombobox is in a grid, which makes it difficult to assess its ClientID. I've been scouring through the Client-Side-API, which implies I could just reference the ClientID, or the ID, however both of these are returning "undefined". Since it is an OnKeyPressed event, I could just set a reference to the control, and then do some jquery to tie into the OnKeyUp event on client-side, but this seems "hacky". I wanted to know if there is a more "blessed" solution. My code is as follows:
<script language="javascript" type="text/javascript"> function getAutocompleteItems(sender, eventArgs) { alert(sender.ClientID) // returns "undefined" alert(sender.ID) // returns "undefined" //var cboItem = new Telerik.Web.UI.RadComboBoxItem(); //cboItem.set_text("Help... somebody!!!"); sender.trackChanges(); var items = sender.get_items() for (var i = 0; i < items.get_count(); i++) { if (!items.getItem(i).get_text().toLowerCase().indexOf(sender.get_text().toLowerCase()) == 0) { items.remove(items.getItem(i)); } } //sender.get_items().add(cboItem); sender.commitChanges(); } </script> <telerik:GridTemplateColumn DataField="LineItem" UniqueName="grdColHostIDDef"> <HeaderStyle Width="0%" HorizontalAlign="Center"/> <ItemStyle HorizontalAlign="Center" Width="0%" VerticalAlign="Top" /> <ItemTemplate> <span class="validatable"><telerik:RadComboBox runat="server" ID="ddlHostValue" CollapseAnimation-Duration="1" ExpandAnimation-Duration="1" ExpandAnimation-Type="Linear" AllowCustomText="true" CausesValidation="false" DataSourceID="HostTypeDataSource" DataTextField="Value" DataValueField="Value" OnClientKeyPressing="getAutocompleteItems" /> </telerik:GridTemplateColumn>