First Item on Dropdownlist in blank
ado.net, asp.net, sql-server
Solution
After your DataBind call, add this code.
DropDownList1.Items.Insert(0, new ListItem(string.Empty, string.Empty));
Problem
How to put the first item on the DropDownList in blank ? In VB is something like, DropDownList.index[0] = ""; I did this: ``` string StrConn = ConfigurationManager.ConnectionStrings["connSql"].ConnectionString; SqlConnection conn = new SqlConnection(StrConn); conn.Open(); SqlDataReader dr; string sql; sql = @"Select Nome From DanielPessoas"; SqlCommand cmd = new SqlCommand(sql, conn); dr = cmd.ExecuteReader(); DropDownList1.DataSource = dr; DropDownList1.DataTextField = "Nome"; DropDownList1.DataValueField = "Nome"; DropDownList1.DataBind(); ```