|100568||Aug 17,2011 03:33 AM||Aug 18,2011 06:54 AM||ASP.NET Web Forms (Classic)||6|
The Autocomplete textbox can be binded to a SqlDataSource in the ProvideChoiceListOnCallback event of the AutocompleteTextbox. An ArrayList can be populated with autocomplete suggestions got from the returned DataView as a result of executing Select() method. The ArrayList can be used as a ChoiceList to populate the Autocomplete Suggestions. Kindly refer the code snippet below to achieve this.
protected void AutoCompleteTextBox1_ProvideChoiceListOnCallback(object sender, Syncfusion.Web.UI.WebControls.Tools.ACUserChoiceListEventArgs e)
ArrayList userChoiceList = new ArrayList();
SqlDataSource SQLds = new SqlDataSource();
SQLds.ID = "SqlDataSource2";
SQLds.ConnectionString = ConfigurationManager.ConnectionStrings["HierarchyDataConnectionString"].ConnectionString;
SQLds.SelectCommand = "SELECT [Controls] FROM [AutoComplete]";
DataView dv = (DataView)SQLds.Select(DataSourceSelectArguments.Empty);
foreach (DataRow myRow in dv.Table.Rows)
e.ChoiceList = userChoiceList;
Also I have created a simple sample to test this and it can be downloaded from the link below.
Kindly try the above sample and please let me know if you have any other queries.
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.