Click here to Skip to main content
15,887,327 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
i have table from database this table has 400000 row in my asp page my dropdown list(ddlPlaintiffName) fill from this method

private void FillPlaintiff()
   {

       //declare connection by pass connection string from web.config
       SqlConnection sqlcon = new SqlConnection
           (ConfigurationManager.ConnectionStrings["SystemConn"].ConnectionString);
       //declare sql statment  as astring variable

       SqlCommand sqlcom = new SqlCommand();
       sqlcom.Connection = sqlcon;
       sqlcom.CommandType = CommandType.StoredProcedure;
       sqlcom.CommandText = "proc_SelectPlaintiff";



       DataTable ds = new DataTable();
       //fill data set with data adabter that contain data from database
    //   sad.Fill(ds);
       sqlcon.Open();
        SqlDataAdapter sad = new SqlDataAdapter(sqlcom);

        sad.Fill(ds);

       ddlPlaintiffName.DataSource = ds;
       ddlPlaintiffName.DataBind();
       ddlPlaintiffName.Items.Insert(0, "--select  --");
       sqlcon.Close();

   }


but every postback my load is very very slow how can i avoid this
Posted
Comments
Nitesh Kejriwal 14-Oct-12 7:44am    
Are you filling the contents in every postback?

The simple solution is: Don't do it.

Think of it from your user's point of view: You try and find the one item you are looking for in a drop down of 400,000 items.
If it simple? Quick? Easy?

Provide a popup, or a filter, or something to make their lives easier.

What you are proposing is almost designed to discourage users from using your software.
 
Share this answer
 
As Griff stated, it is no use putting so much data in a dropdown. The user won't be able ho handle it anyway. I would use an autocomplete extended textbox[^] plus a validation of course, if the options can be filtered directly.
But I can not imagine what can have that much options, so I suppose a single dropdown/autocomplete won't be enough from usability point of view.
 
Share this answer
 
Comments
nagiub2007 14-Oct-12 8:31am    
@Zoltán Zörgő
but i want to choose name from textbox thos name hold it's id from database
how to do this
Zoltán Zörgő 14-Oct-12 8:37am    
If you have to choose names, and you don't have any other way to filter it (I doubt), than use a single autocomplete. Read first the article I have linked, than ask other questions!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900