dropdownlist fill problem
-
pls i have a dropdown list which gets data from my database, i want it to be filled only once when the page is loaded. pls how do i archieve this. thanks.
-
pls i have a dropdown list which gets data from my database, i want it to be filled only once when the page is loaded. pls how do i archieve this. thanks.
put the databinding in !ispostback i.e. if(!ispostback) { ddl.bind(); }
Gaurav Dudeja http://www.gdinfotechindia.com
Dont be afraid of changing your life to better ! -
pls i have a dropdown list which gets data from my database, i want it to be filled only once when the page is loaded. pls how do i archieve this. thanks.
I have done so, i put the code snipet in the page load event, it is giving me object refrence not set to an instance of an object, pls what didi i do wrong thank you.
-
I have done so, i put the code snipet in the page load event, it is giving me object refrence not set to an instance of an object, pls what didi i do wrong thank you.
Also set the datasource property as
if(!IsPostBack)
{
ddl.DataSource = collection;//Set the records from db here
ddl.DataBind();
}Cheers!! Brij Check my latest Article :URL Routing with ASP.NET 4.0
-
Also set the datasource property as
if(!IsPostBack)
{
ddl.DataSource = collection;//Set the records from db here
ddl.DataBind();
}Cheers!! Brij Check my latest Article :URL Routing with ASP.NET 4.0
thank you for your reply, I am using dataset to load the tables, i then assign the column i want to show to the list. how do i databind with the dataset object. thank you
-
thank you for your reply, I am using dataset to load the tables, i then assign the column i want to show to the list. how do i databind with the dataset object. thank you
it is working now.. thanks everybody.
-
thank you for your reply, I am using dataset to load the tables, i then assign the column i want to show to the list. how do i databind with the dataset object. thank you
set like this
ddl.DataValueField = "columnname1";//for ID
ddl.DataTextField = "columnname2";// for Value
ddl.DataSource = datatable;
ddl.DataBind();Cheers!! Brij Check my latest Article :URL Routing with ASP.NET 4.0