T
to_rgoyal
Hi All,
I am creating one web base application using ASP.net and C#. I am
populating dropdown lists of my web
pages using database. I am using this code:
con = new SqlConnection(connectionString);
SqlCommand getresult = new SqlCommand("select distinct(owner) from
issue_log",con);
con.Open();
sqlReader = getresult.ExecuteReader();
OwnerDropDownList.DataSource=sqlReader;
OwnerDropDownList.DataTextField="Owner";
OwnerDropDownList.SelectedIndex=0;
OwnerDropDownList.DataBind();
sqlReader.Close();
con.Close();
After using this, my dropdown list is successfully populated with table
values.
But I also want to add one more value with text 'None' and value ''
to my dropdown list with selected= truth.
That is it should be default value of my dropdownlist.How can I do
this?
I tried to add this value using visual studio development
environment. But, it is not being appended with
table values.
Please help me. Thanks in advance.
I am creating one web base application using ASP.net and C#. I am
populating dropdown lists of my web
pages using database. I am using this code:
con = new SqlConnection(connectionString);
SqlCommand getresult = new SqlCommand("select distinct(owner) from
issue_log",con);
con.Open();
sqlReader = getresult.ExecuteReader();
OwnerDropDownList.DataSource=sqlReader;
OwnerDropDownList.DataTextField="Owner";
OwnerDropDownList.SelectedIndex=0;
OwnerDropDownList.DataBind();
sqlReader.Close();
con.Close();
After using this, my dropdown list is successfully populated with table
values.
But I also want to add one more value with text 'None' and value ''
to my dropdown list with selected= truth.
That is it should be default value of my dropdownlist.How can I do
this?
I tried to add this value using visual studio development
environment. But, it is not being appended with
table values.
Please help me. Thanks in advance.