how to get empty row in DropDownList

Posted by Gali on Stack Overflow See other posts from Stack Overflow or by Gali
Published on 2011-01-13T10:48:31Z Indexed on 2011/01/13 10:53 UTC
Read the original article Hit count: 194

Filed under:
|

hi

i have this citys in my database:

city1
city2
city3
city4

i what to see this in my DropDownList:

[empty]
city1
city2
city3
city4

this is my bind code:

SQL = "select distinct City from MyTbl order by City";
dsClass = new DataSet();
adp = new SqlDataAdapter(SQL, Conn);
adp.Fill(dsClass, "MyTbl");
adp.Dispose();
DropDownList3.DataSource = dsClass.Tables[0];
DropDownList3.DataTextField = dsClass.Tables[0].Columns[0].ColumnName.ToString();
DropDownList3.DataValueField = dsClass.Tables[0].Columns[0].ColumnName.ToString();
DropDownList3.DataBind();

how to do it (asp.net C#) ?

thanks in advance

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET