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

Set selected value without binding

2 Answers 68 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Mickael
Top achievements
Rank 1
Mickael asked on 11 Oct 2014, 06:34 PM
Hi,

I have a RadAutoCompleteBox that I add dynamically at run time for editing values.
I can set all settings that I need and add it to the page without problems.

I just can't find out how to set it's text value because the 'text' property is read only.
I want to search the items only when the user modifies the current value.

This is my code so far:

_autoCompleteBox = new RadAutoCompleteBox();
_autoCompleteBox.ID = String.Format("Extra_RdtCmpltBx_{0}_{1}", Data.Name, ID);
_autoCompleteBox.Filter = RadAutoCompleteFilter.StartsWith;
_autoCompleteBox.DropDownPosition = RadAutoCompleteDropDownPosition.Automatic;
_autoCompleteBox.AllowCustomEntry = true;
_autoCompleteBox.InputType = RadAutoCompleteInputType.Text;
_autoCompleteBox.WebServiceSettings.Method = "GetResults";
_autoCompleteBox.WebServiceSettings.Path = "Popup_EditData.aspx";

2 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 14 Oct 2014, 08:14 AM
Hello Michael,

In order to achieve the desired functionality, you need to add a new entry to the EntriesCollection of the programmatically created RadAutoCompleteBox. Please consider the following implementation :

_autoCompleteBox = new RadAutoCompleteBox();
_autoCompleteBox.ID = String.Format("Extra_RdtCmpltBx_{0}_{1}", Data.Name, ID);
_autoCompleteBox.Filter = RadAutoCompleteFilter.StartsWith;
_autoCompleteBox.DropDownPosition = RadAutoCompleteDropDownPosition.Automatic;
_autoCompleteBox.AllowCustomEntry = true;
_autoCompleteBox.InputType = RadAutoCompleteInputType.Text;
_autoComplete.Entries.Add(new AutoCompleteBoxEntry("Custom Entry"));
_autoCompleteBox.WebServiceSettings.Method = "GetResults";
_autoCompleteBox.WebServiceSettings.Path = "Popup_EditData.aspx";



Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mickael
Top achievements
Rank 1
answered on 14 Oct 2014, 12:09 PM
Works like a charm.
Thanks a lot :)
Tags
AutoCompleteBox
Asked by
Mickael
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Mickael
Top achievements
Rank 1
Share this question
or