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
First of all you should not use such a big table for dropdown list. Since user can’t find value easily , there is no use for him. You should provide some kind of search and based on search criteria, though ajax, data should show in dropdown list. Search should start only when user put three or more characters, Else your ajax based query also become slow.
Please refer the following page to get an idea
jQuery Searchable DropDown Plugin Demo