This is a migrated thread and some comments may be shown as answers.

Modify radcombo text in onclientkeypress

1 Answer 85 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Neema Sridhar
Top achievements
Rank 1
Neema Sridhar asked on 11 Mar 2013, 05:26 AM
Hi,
I am using radcombobox having item templates. The data to the radcombo is binded at client side. The itemtemplate consists of div.
when the dropdown is expanded, the list items looks like <<Account Numbe>>r <<AccountName>>.  When I select any of the value  from the dropdown, text would appear as Account Number Account Name. I wanted to displaye only Account Number, So I modified the data in OnclientselectedIndex changed event. This works fine.

When i use keyboard to move through the items, Account Number Account Name is displayed. Here also I want to set the text for the combox as only Account Number.
 I made use of OnclientKeypressing event and added sender.set_text("ABC"); The code gets executed, but, I do not see the changes refelected.

I also trie making user of get_inpiutDOmelement and set the value. But nothing seems to reflect in browser.

Please let me know how I can modify the value of the combox text while using keyboard.

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 13 Mar 2013, 01:55 PM
Hi Neema,

How do you bind your combo? Do you use ItemTemplate or ClientItemTemplate? If you are using ItemTemplate you may try to set DataValueField and DataTextField:
<telerik:RadComboBox
    ID="RadComboBox2"
    runat="server"
    Width="300px"
    DataValueField="AccountNumber"
    Filter="Contains"
    HighlightTemplatedItems="true"
    MarkFirstMatch="true"
    DataTextField="AccountNumber">
    <ItemTemplate>
        << <%# Eval("AccountNumber") %>>>
        << <%# Eval("AccountName") %> >>
    </ItemTemplate>
</telerik:RadComboBox>


Regards,
Hristo Valyavicharski
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Neema Sridhar
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or