コード例 #1
0
 protected void LoadDropDownListVenue()
 {
     string[] venues = db.GetVenues();
     DropDownListVenue.DataSource = venues;
     DropDownListVenue.DataBind();
     DropDownListVenue.Items.Insert(0, "Choose a Venue");
 }
コード例 #2
0
        private void BindDropDown()
        {
            PmsSysBiz      pmsSysBiz  = new PmsSysBiz();
            IList <PmsSys> listPmsSys = pmsSysBiz.SelectData2ByTypeData1("PM", "MeetingMinute", "MeetingType");

            DropDownListMeetingMinuteType.DataSource     = listPmsSys;
            DropDownListMeetingMinuteType.DataTextField  = "data2";
            DropDownListMeetingMinuteType.DataValueField = "data2";
            DropDownListMeetingMinuteType.DataBind();

            DropDownListMeetingMinuteType.Items.Insert(0, new ListItem());
            DropDownListMeetingMinuteType.Items[0].Text  = "";
            DropDownListMeetingMinuteType.Items[0].Value = "";

            IList <PmsSys> listPmsSysVenue = pmsSysBiz.SelectData2ByTypeData1("PM", "MeetingMinute", "Venue");

            DropDownListVenue.DataSource     = listPmsSysVenue;
            DropDownListVenue.DataTextField  = "data2";
            DropDownListVenue.DataValueField = "data2";
            DropDownListVenue.DataBind();

            DropDownListVenue.Items.Insert(0, new ListItem());
            DropDownListVenue.Items[0].Text  = "";
            DropDownListVenue.Items[0].Value = "";

            IList <PmsSys> listPmsSysHour = pmsSysBiz.SelectData2ByTypeData1("PM", "MeetingTime", "Hour");

            DropDownListStartHour.DataSource     = listPmsSysHour;
            DropDownListStartHour.DataTextField  = "data2";
            DropDownListStartHour.DataValueField = "data2";
            DropDownListStartHour.DataBind();

            DropDownListEndHour.DataSource     = listPmsSysHour;
            DropDownListEndHour.DataTextField  = "data2";
            DropDownListEndHour.DataValueField = "data2";
            DropDownListEndHour.DataBind();

            // 选中 10;

            IList <PmsSys> listPmsSysMinute = pmsSysBiz.SelectData2ByTypeData1("PM", "MeetingTime", "Minute");

            DropDownListStartMinute.DataSource     = listPmsSysMinute;
            DropDownListStartMinute.DataTextField  = "data2";
            DropDownListStartMinute.DataValueField = "data2";
            DropDownListStartMinute.DataBind();

            DropDownListEndMinute.DataSource     = listPmsSysMinute;
            DropDownListEndMinute.DataTextField  = "data2";
            DropDownListEndMinute.DataValueField = "data2";
            DropDownListEndMinute.DataBind();

            //选中 00;
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Calendar1.SelectedDate = DateTime.Today;
            if (User.Identity.IsAuthenticated)
            {
                string username = User.Identity.Name;
                userName.Text = username;
            }

            if (!IsPostBack)
            {
                string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
                using (SqlConnection con = new SqlConnection(CS))
                {
                    //for event dropdown
                    SqlCommand cmd = new SqlCommand("Select eId, eName from tblEvents", con);
                    con.Open();
                    SqlDataReader rdr = cmd.ExecuteReader();
                    DropDownListEvents.DataTextField  = "eName";
                    DropDownListEvents.DataValueField = "eId";
                    DropDownListEvents.DataSource     = rdr;
                    DropDownListEvents.DataBind();
                }
                using (SqlConnection con2 = new SqlConnection(CS))
                {
                    //for venue dropdown
                    SqlCommand cmd2 = new SqlCommand("Select vId, vName, vLocation, vImage, vDescription, vCapacity from tblVenues", con2);
                    con2.Open();
                    SqlDataReader rdr2 = cmd2.ExecuteReader();
                    DropDownListVenue.DataTextField  = "vName";
                    DropDownListVenue.DataValueField = "vId";
                    DropDownListVenue.DataSource     = rdr2;
                    DropDownListVenue.DataBind();
                }
            }
        }