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

Select Single Value from drop down and Add Styles.

1 Answer 74 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Anly
Top achievements
Rank 1
Anly asked on 14 Feb 2013, 02:44 AM
Hi,

I am having a RadAutoCompleteBox and RadTextBox in one of my pages. My requirement is that I must be able to select only one value from the dropdown that must be shown in a desired color and after selecting the item from the drop-down, I want my textbox to be focussed.

Please help.
-Anly.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 14 Feb 2013, 04:58 AM
Hi Anly,

You can set the TextSettings SelectionMode to Single so that only one value can be selected from the drop-down. You can use the OnClientDropDownClosed event to change the focus to the RadTextBox once a value is selected from the drop down.

ASPX:
<telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" EmptyMessage="Enter Name"
    ForeColor="Red" InputType="Text" DataSourceID="SqlDataSource2" DataTextField="ContactName"
    OnClientDropDownClosed="OnClientDropDownClosed">
    <TextSettings SelectionMode="Single" />
</telerik:RadAutoCompleteBox>
<telerik:RadTextBox ID="RadTextBox" runat="server">
</telerik:RadTextBox>

Javascript:
<script type="text/javascript">
    function OnClientDropDownClosed(sender, args) {
        document.getElementById("RadTextBox").focus();
    }
</script>

Thanks,
Princy.
Tags
AutoCompleteBox
Asked by
Anly
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or