//sukhmanbaath-300986381 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Calendar1.Visible = false; string connectionString = ConfigurationManager.ConnectionStrings["SoccerLeague"].ConnectionString; SqlConnection con = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand("Select * from ClubTable", con); con.Open(); DropDownListTeam.DataSource = cmd.ExecuteReader(); DropDownListTeam.DataTextField = "ClubName"; DropDownListTeam.DataValueField = "ClubRegistrationNo"; DropDownListTeam.DataBind(); con.Close(); con.Open(); DropDownList2.DataSource = cmd.ExecuteReader(); DropDownList2.DataTextField = "ClubName"; DropDownList2.DataValueField = "ClubRegistrationNo"; DropDownList2.DataBind(); con.Close(); con.Open(); DropDownList3.DataSource = cmd.ExecuteReader(); DropDownList3.DataTextField = "ClubName"; DropDownList3.DataValueField = "ClubRegistrationNo"; DropDownList3.DataBind(); con.Close(); } }
private void BindDropDownList() { IList <BaseDataDepartment> baseDataDepartment = bugInquiryBiz.SelectBaseDataDepartmentNameId(); DropDownListTeam.DataSource = baseDataDepartment; DropDownListTeam.DataTextField = "Name"; DropDownListTeam.DataValueField = "Id"; DropDownListTeam.DataBind(); //DropDownListTeam.Items.Insert(0, ""); IList <BaseDataUser> baseDataUser = bugInquiryBiz.SelectUserName(); DropDownListCrSd.DataSource = baseDataUser; DropDownListCrSd.DataTextField = "UserName"; DropDownListCrSd.DataValueField = "UserName"; DropDownListCrSd.DataBind(); DropDownListCrSd.Items.Insert(0, ""); DropDownListCrQa.DataSource = baseDataUser; DropDownListCrQa.DataTextField = "UserName"; DropDownListCrQa.DataValueField = "UserName"; DropDownListCrQa.DataBind(); DropDownListCrQa.Items.Insert(0, ""); DropDownListBugOwner.DataSource = baseDataUser; DropDownListBugOwner.DataTextField = "UserName"; DropDownListBugOwner.DataValueField = "UserName"; DropDownListBugOwner.DataBind(); DropDownListBugOwner.Items.Insert(0, ""); DropDownListBugCreator.DataSource = baseDataUser; DropDownListBugCreator.DataTextField = "UserName"; DropDownListBugCreator.DataValueField = "UserName"; DropDownListBugCreator.DataBind(); DropDownListBugCreator.Items.Insert(0, ""); }