protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <string> ls = new List <string>(); ls.Add("--Select--"); ls.Add("Karnataka"); ls.Add("Tamilnadu"); ls.Add("Andra Pradesh"); ls.Add("Kerala"); ddlState.DataSource = ls; ddlState.DataBind(); List <string> list = new List <string>(); list.Add("--Select--"); list.Add("Fresher"); list.Add("Experienced"); DDLlStatus.DataSource = list; DDLlStatus.DataBind(); List <string> lsCourse = new List <string>(); lsCourse.Add("--Select--"); lsCourse.Add("BCA"); lsCourse.Add("BBM"); lsCourse.Add("B.Com"); lsCourse.Add("B.A"); DDLStream.DataSource = lsCourse; DDLStream.DataBind(); List <string> ls1 = new List <string>(); ls1.Add("--Select--"); ls1.Add("Computer Science"); ls1.Add("Science"); ls1.Add("Commerce"); DDLStream.DataSource = ls1; DDLStream.DataBind(); List <string> Salary = new List <string>(); Salary.Add("--Select Salary--"); Salary.Add("10000-20000"); Salary.Add("20000-30000"); Salary.Add("30000-40000"); Salary.Add("40000-50000"); Salary.Add("50000-60000"); Salary.Add("60000-70000"); Salary.Add("70000-80000"); Salary.Add("80000-90000"); Salary.Add("90000-100000"); Salary.Add("> 1 Lakh"); DDLlAnnualSalry.DataSource = Salary; DDLlAnnualSalry.DataBind(); List <string> ls3 = new List <string>(); ls3.Add("--Select--"); ls3.Add("myCity"); ls3.Add("otherCity"); ddlState.DataSource = ls; ddlState.DataBind(); } }
private void BindStreamDropDown() { string query = " Select * from Stream"; DataTable dt = c.getData(query); DDLStream.DataSource = dt; DDLStream.DataValueField = "streamid"; DDLStream.DataTextField = "streamName"; DDLStream.DataBind(); DDLStream.Items.Insert(0, new ListItem("-- Select --", "")); foreach (ListItem myItem in DDLStream.Items) { myItem.Attributes.Add("style", "background-color:#111111"); //myItem.Attributes.Add("style", "fore-color:white"); } //ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('hey')", true); c.closeConn(); }