Modify radcombo text in onclientkeypress

2 posts, 0 answers
  1. Neema Sridhar
    Neema Sridhar avatar
    8 posts
    Member since:
    Oct 2009

    Posted 11 Mar 2013 Link to this post

    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.
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 13 Mar 2013 Link to this post

    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.
Back to Top