We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to populate the AutoCompleteTextBox in code behind.

Thread ID:

Created:

Updated:

Platform:

Replies:

73832 May 21,2008 04:29 PM May 22,2008 10:29 AM ASP.NET Web Forms (Classic) 1
loading
Tags: Tools
Andy Richard
Asked On May 21, 2008 04:29 PM

I'm trying to populate the AutoCompleteTextBox in code behind. The data is coming from a Web service as a strongly-typed dataset. I notice a DataSourceID property, but not a DataSource property. Any ideas?

This is urgent!


Janagan [Syncfusion]
Replied On May 22, 2008 10:29 AM

Hi Andy,

Thanks for your interest in Syncfusion products.

You can populate the autocomplete textbox with dataset in code behind by the ProvideChoiceListOnCallback as mentioned in the code below:



protected void AutoCompleteTextBox1_ProvideChoiceListOnCallback(object sender, Syncfusion.Web.UI.WebControls.Tools.ACUserChoiceListEventArgs e)
{
ArrayList List = new ArrayList();
string key = e.Key;
DataSet dataset = new DataSet();
string url = "Id.xml";
dataset.ReadXml(this.Context.Server.MapPath(url));
DataTable dataTable = new DataTable();
dataTable = dataset.Tables[0];
DataRow[] Matchrow = dataset.Tables[0].Select(" Id like '" + key + "%'");
foreach (DataRow row in Matchrow)
{
string Id = row[0].ToString();
List.Add(Id);
}
e.ChoiceList = List;
}



Please refer the sample in the link below which illustrates the above:

http://websamples.syncfusion.com/samples/Tools.Web/6.2.0.40/Tools_ASP_Autocompletetextbox/main.htm


Please try running the sample and let me know if this helps.

Regards,
Janagan.




CONFIRMATION

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.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;