954,157 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Dropdown bind

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.

thirumca
Newbie Poster
12 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

hi,

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

greeny_1984
Posting Whiz
372 posts since Apr 2007
Reputation Points: 25
Solved Threads: 29
 

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;
			}
		}
thirumca
Newbie Poster
12 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

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

P.K.Chaudhary
Light Poster
30 posts since Mar 2009
Reputation Points: 10
Solved Threads: 5
 

hi,

you can use webservices to load data in to dropdownlist.

greeny_1984
Posting Whiz
372 posts since Apr 2007
Reputation Points: 25
Solved Threads: 29
 

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

thirumca
Newbie Poster
12 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 
greeny_1984
Posting Whiz
372 posts since Apr 2007
Reputation Points: 25
Solved Threads: 29
 

Hi,
Thanks for ur reply.

thirumca
Newbie Poster
12 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

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.

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

hi,
Thanks for your reply

thirumca
Newbie Poster
12 posts since Mar 2009
Reputation Points: 10
Solved Threads: 0
 

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

subburaj.r
Newbie Poster
4 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You