Hi,

how to bind dropdownlist in few seconds

I have one table in msaccess database, but this table contains 2500 records. I need to bind these records to asp.net dropdown list, but its take long time to bind the datas. so pls give any new method for binding the datas into dropdownlist with quick and few minutes.

hi,

can you show u r code for retrieving data from database.

Hi,
This is code for retrive data from database

public static void Neweventsfilldd1(DropDownList dd_count,string query , string field,string valfield)
		{
			try
			{				
				DataTable dt = new DataTable();
				OleDbDataAdapter da = new OleDbDataAdapter(query,ConnectionString);
				da.Fill(dt);
				dd_count.DataSource = dt;
				dd_count.DataTextField = dt.Columns[field].ToString();
				dd_count.DataValueField=dt.Columns[valfield].ToString();
				dd_count.DataBind();
			}
			catch(Exception e)
			{
				System.Diagnostics.Debug.Write(e.Message);
				throw;
			}
		}

Hi,
Try using caching or ajax, these are the only two ways you can solve this problem.

hi,

you can use webservices to load data in to dropdownlist.

Hi,
How can we use webservice for dropdown binding? Please give the sample code for binding dropdown using webservice

Hi,
Thanks for ur reply.

What database are you using? OLE is slow but may be your only choice.

Also use a reader (forward only cursor) instead of a DataTable, it's faster for this kind of scenario.

But, consider the design. 2500 options in a drop Down List box ??? I can't think of any reason why I would want to choose from that many items in any application as a user. Consider filtering this list into sections/categories and have another drop down for the user to choose a section/category and then load only those items into the dropdown at a time.

hi,
Thanks for your reply

Hi,

how to bind dropdownlist in few seconds

I have one table in msaccess database, but this table contains 2500 records. I need to bind these records to asp.net dropdown list, but its take long time to bind the datas. so pls give any new method for binding the datas into dropdownlist with quick and few minutes.

ans:

Use AJEX extension toolbox in which update panel try to put your dropdown list other inline codings are same.This will be faster and you can only work in ASP.Net 2.0 and above version

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.