6 Answers, 1 is accepted
0
Hello Rahul,
Please use the RadAutoCompleteBox EntryAdded server-side event and enable by setting AutoPostBack property to "True"
//markup code
//code behind
Regards,
Boyan Dimitrov
Telerik
Please use the RadAutoCompleteBox EntryAdded server-side event and enable by setting AutoPostBack property to "True"
//markup code
<
telerik:RadAutoCompleteBox
ID
=
"RadAutoCompleteBox1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
DataTextField
=
"ContactName"
DataValueField
=
"CustomerID"
AutoPostBack
=
"true"
OnEntryAdded
=
"RadAutoCompleteBox1_EntryAdded"
>
</
telerik:RadAutoCompleteBox
>
<
asp:SqlDataSource
runat
=
"server"
ID
=
"SqlDataSource1"
ConnectionString="<%$ ConnectionStrings:NorthwindConnString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT [CustomerID], [ContactName] FROM [Customers] ORDER By ContactName">
</
asp:SqlDataSource
>
//code behind
protected
void
RadAutoCompleteBox1_EntryAdded(
object
sender, AutoCompleteEntryEventArgs e)
{
AutoCompleteBoxEntry entry = e.Entry;
//you can access the entry text
String entryText = entry.Text;
}
Regards,
Boyan Dimitrov
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Ciupaz
Top achievements
Rank 2
Veteran
answered on 25 Jun 2020, 05:29 AM
And how can I populate a List of strings (items keys) from all the items selected by the user in the RadAutoCompleteBox in a WebForms page?
L.
0
Hello L.,
The "selected items" are available only in the Entries collection of the AutoCompleteBox.
Once you get the entries, you can use any method to collect their texts or values and create any collection out of them.
Regards,
Peter Milchev
Progress Telerik
Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Our thoughts here at Progress are with those affected by the outbreak.
0
Ciupaz
Top achievements
Rank 2
Veteran
answered on 29 Jun 2020, 01:25 PM
Do you have an example Peter?
Luigi
0
Hello Luigi,
Here is a simple example iterating the Entries collection and getting the Text of the entries:
protected void RadButton1_Click(object sender, EventArgs e)
{
var texts = new List<string>();
foreach (AutoCompleteBoxEntry entry in RadAutoCompleteBox1.Entries)
{
texts.Add(entry.Text);
}
}
Another option is demonstrated here:
- https://demos.telerik.com/aspnet-ajax/autocompletebox/examples/functionality/client-filtering/defaultcs.aspx
- https://demos.telerik.com/aspnet-ajax/autocompletebox/examples/applicationscenarios/defaultcs.aspx
Regards,
Peter Milchev
Progress Telerik
Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Our thoughts here at Progress are with those affected by the outbreak.
0
Ciupaz
Top achievements
Rank 2
Veteran
answered on 01 Jul 2020, 12:24 PM
Thank you Peter, this is Ok.
Luigi