Step 1:
<SELECT id="DropDownList1" name="yourDropDownList1" runat="server"></SELECT>
Step 2:
SqlConnection mycn;
SqlDataAdapter myda;
DataSet ds;
String strConn;
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
strConn="Data Source=localhost;uid=sa;pwd=;Initial Catalog=northwind";
mycn = new SqlConnection(strConn);
myda = new SqlDataAdapter ("Select * FROM CategoryTable ", mycn);
ds = new DataSet();
myda.Fill (ds,"Table");
yourDropDownList1.DataSource =ds.Tables [0] ;
yourDropDownList1.DataTextField =ds.Tables[0].Columns["CategoryName"].ColumnName.ToString();
yourDropDownList1.DataValueField =ds.Tables[0].Columns["CategoryId"].ColumnName.ToString();
yourDropDownList1.DataBind () ;
}
}
asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
asp wysiwyg html editor: http://cutesoft.net/ASP
asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
Live Support: http://cutesoft.net/live-support/default.aspx