Example #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                for (var i = DateTime.Now.Year; i < DateTime.Now.Year + 3; i++)
                {
                    var list = new ListItem
                                   {
                                       Text = i.ToString(),
                                       Value = i.ToString()
                                   };
                    ddlYear.Items.Add(list);
                }

                var month = Convert.ToDateTime("1/1/2000");
                for (var i = 0; i < 12; i++)
                {
                    var nextMonth = month.AddMonths(i);
                    var list = new ListItem
                                   {
                                       Text = nextMonth.ToString("MMMM"),
                                       Value = nextMonth.Month.ToString()
                                   };
                    ddlMonth.Items.Add(list);
                }
                ddlYear.SelectedValue = DateTime.Now.Year.ToString();
                ddlMonth.SelectedValue = DateTime.Now.Month.ToString();
            }

            btnGoToDate.Click += btnGoToDate_Click;
        }
 protected void BindDropDownNam()
 {
     //ddlNam.Items.Clear();
     //lbMessage.Text = "";
     //SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString);
     //con.Open();
     //string sql = "select year(ngay) Nam from CV_CapSo where ngay is not null group by year(ngay) order by year(ngay) desc";
     //SqlCommand cmd = new SqlCommand(sql, con);
     //SqlDataReader sdr = cmd.ExecuteReader();
     //if (sdr.HasRows)
     //{
     //    while (sdr.Read())
     //    {
     //        if (sdr.GetValue(sdr.GetOrdinal("Nam")).ToString() != null || sdr.GetValue(sdr.GetOrdinal("Nam")).ToString() != "")
     //        {
     //            int nam = Convert.ToInt32(sdr.GetValue(sdr.GetOrdinal("Nam")).ToString());
     //            ListItem li = new ListItem();
     //            li.Value = nam.ToString();
     //            li.Text = nam.ToString();
     //            ddlNam.Items.Add(li);
     //        }
     //    }
     //}
     //con.Close();
     for (int i = 0; i < 5; i++)
     {
         ListItem li = new ListItem();
         li.Value = (DateTime.Today.Year - i).ToString();
         li.Text = (DateTime.Today.Year - i).ToString();
         ddlNam.Items.Add(li);
     }
 }
Example #3
0
        void LoadOptions()
        {
            
                ddlDistrict.DataSource = DistrictBO.GetAll(true);
                ddlDistrict.DataValueField = "DistrictID";
                ddlDistrict.DataTextField = "DistrictName";
                ddlDistrict.DataBind();
            

            ListItem li = new ListItem("[Gender]", "");
            ddlGender.Items.Add(li);
            li = new ListItem("Male", "M");
            ddlGender.Items.Add(li);
            li = new ListItem("Female", "F");
            ddlGender.Items.Add(li);


            li = new ListItem("[Status]", "");
            ddlStatus.Items.Add(li);
            li = new ListItem("Completed", "Completed");
            ddlStatus.Items.Add(li);
            li = new ListItem("Running", "Running");
            ddlStatus.Items.Add(li);

            //li = new ListItem("[Compensation]", "");
            //ddlCompensation.Items.Add(li);
            //li = new ListItem("Yes", "Yes");
            //ddlCompensation.Items.Add(li);
            //li = new ListItem("No", "No");
            //ddlCompensation.Items.Add(li);
        }
Example #4
0
        protected void Page_Load(object sender, System.EventArgs e)
		{
			sbmt.Text = ui.Text("create");
			int NodeId = int.Parse(Request["nodeID"]);
			
			int[] allowedIds = new int[0];
			if (NodeId > 2) 
			{
				cms.businesslogic.Content c = new cms.businesslogic.media.Media(NodeId);
				allowedIds = c.ContentType.AllowedChildContentTypeIDs;
			}

		    var documentTypeList = businesslogic.media.MediaType.GetAllAsList().ToList();
		    foreach (var dt in documentTypeList)
			{
				ListItem li = new ListItem();
				li.Text = dt.Text;
				li.Value = dt.Id.ToString();
				
				if (NodeId > 2) 
				{
					foreach (int i in allowedIds) if (i == dt.Id) nodeType.Items.Add(li);
				}
                // The Any check is here for backwards compatibility, if none are allowed at root, then all are allowed
                else if (documentTypeList.Any(d => d.AllowAtRoot) == false || dt.AllowAtRoot)
					nodeType.Items.Add(li);
			}
		}
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string app = gform("app");
            int tempid = 0;
            gnum(ref tempid, "id");
            switch (app)
            { 
                case "resettemplate":
                    reset_template(tempid);
                    showMessage("使用成功,刷新全部模板成功");
                    break;
                default:
                    break;

            }

            if (!IsPostBack)
            {
                TemplateTypeDal dal = new TemplateTypeDal();
                foreach (TemplateTypeInfo info in dal.view_list())
                {
                    ListItem item = new ListItem(info.templateName, info.templateName);

                    if ("template/"+info.templateName == TEMPLATEPATH)
                    {
                        item.Selected = true;
                    }
                    main_template.Items.Add(item);
                    //else
                    //main_template.Items.Add(new ListItem(info.templateName, info.templateName));
                }
            }
        }
        private void Load_catesearch()
        {
            var list = per.Load_danhmuc_search(1);
            if (list.Count > 0)
            {
                DataRelation relCat;
                DataTable tbl = DataUtil.LINQToDataTable(list);
                DataSet ds = new DataSet();
                ds.Tables.Add(tbl);

                tbl.PrimaryKey = new DataColumn[] { tbl.Columns["CAT_ID"] };
                relCat = new DataRelation("Category_parent", ds.Tables[0].Columns["CAT_ID"], ds.Tables[0].Columns["CAT_PARENT_ID"], false);

                ds.Relations.Add(relCat);
                DataSet dsCat = ds.Clone();
                DataTable CatTable = ds.Tables[0];

                DataUtil.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null);

                Drcate_search.DataSource = dsCat.Tables[0];
                Drcate_search.DataTextField = "CAT_NAME";
                Drcate_search.DataValueField = "CAT_ID";
                Drcate_search.DataBind();
            }
            ListItem l = new ListItem("Tất cả", "0");
            l.Selected = true;
            Drcate_search.Items.Insert(0, l);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            templateID = int.Parse(Request["id"]);
            Template t = new Template(templateID);

            if (Skinning.StarterKitGuid(templateID).HasValue)
            {
                p_apply.Visible = true;

                string currentSkin = Skinning.GetCurrentSkinAlias(templateID);
                int templateRoot = FindTemplateRoot((CMSNode)t);

                dd_skins.Items.Add("Choose...");
                foreach (KeyValuePair<string,string> kvp in Skinning.AllowedSkins(templateRoot))
                {
                    ListItem li = new ListItem(kvp.Value, kvp.Key);
                    if (kvp.Key == currentSkin)
                        li.Selected = true;

                    dd_skins.Items.Add(li);
                }

                if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(templateID)))
                {
                    ph_rollback.Visible = true;
                }
            }
        }
Example #8
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			sbmt.Text = ui.Text("create");
			int NodeId = int.Parse(Request["nodeID"]);
			
			int[] allowedIds = new int[0];
			if (NodeId > 2) 
			{
				cms.businesslogic.Content c = new cms.businesslogic.media.Media(NodeId);
				allowedIds = c.ContentType.AllowedChildContentTypeIDs;
			}

			foreach(cms.businesslogic.ContentType dt in cms.businesslogic.media.MediaType.GetAll) 
			{
				ListItem li = new ListItem();
				li.Text = dt.Text;
				li.Value = dt.Id.ToString();
				
				if (NodeId > 2) 
				{
					foreach (int i in allowedIds) if (i == dt.Id) nodeType.Items.Add(li);
				} 
				else
					nodeType.Items.Add(li);
			}
		}
        /// <summary>
        /// 初始化
        /// </summary>
        private void Innit()
        {
            ListItem nullItems = new ListItem();
            nullItems.Value = "";
            nullItems.Text = "请选择";


            //初始化项目编号
            ProjectNO_Input.Items.Add(nullItems);
            List<T_ProjectDicEntity> projectlist = BusinessFacadeShanlitech_Location.GetProjectList();
            foreach (T_ProjectDicEntity r in projectlist)
            {
                ListItem item = new ListItem();
                item.Text = r.ProjectName;
                item.Value = r.ID.ToString();
                ProjectNO_Input.Items.Add(item);
            }

            //初始化申请人
            Applicant_Input.Items.Add(nullItems);
            ArrayList userlist = BusinessFacadeShanlitech_Location.GetUserList();
            foreach (sys_UserTable r in userlist)
            {
                ListItem item = new ListItem();
                item.Value = r.UserID.ToString();
                item.Text = r.U_LoginName;
                if (!r.U_LoginName.Equals(""))
                {
                    Applicant_Input.Items.Add(item);
                }
            }

        }
Example #10
0
        protected void initdata()
        {
            /*
            DropDownListDept.Items.Clear();
            List<Department> deps = BLL.admin.department.DepartmentManagement.getDepartments();
            foreach (Department dept in deps)
            {
                ListItem item = new ListItem();
                item.Text = dept.Name;
                item.Value = dept.Name;
                DropDownListDept.Items.Add(item);
            }
            */
            DropDownListType.Items.Clear();
            ListItem lin = new ListItem("");
            DropDownListType.Items.Add(lin);

            List<KQ_AttendanceType> t = BLL.Application.KQ.Attendance.MyAttendance.getAttendanceType();
            foreach (KQ_AttendanceType li in t)
            {
                ListItem l = new ListItem();
                l.Text = li.name;
                l.Value = li.Id.ToString();
                DropDownListType.Items.Add(l);
            }
            AspNetPager1.PageSize = BLL.pub.PubClass.PAGE_SIZE;
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.MaintainScrollPositionOnPostBack = true;

            HttpCookie userCookie;
            HttpCookie passCookie;

            userCookie = Request.Cookies["UserID"];
            passCookie = Request.Cookies["UserPass"];

            if (userCookie == null || passCookie == null)
            {

                if (!IsPostBack)
                {
                    ListBox1.Items.Clear();
                    ListBox1.Width = 100;
                    ListBox1.Height = 60;
                    ListItem f = new ListItem("Female", "0");
                    ListItem m = new ListItem("Male", "1");
                    ListBox1.Items.Add(f);
                    ListBox1.Items.Add(m);
                }
            }
            else
            {
                Response.Redirect("..//Default.aspx");
            }
        }
Example #12
0
        /// <summary>
        /// 绑定生成一个有树结构的下拉菜单
        /// </summary>
        /// <param name="dtNodeSets">菜单记录数据所在的表</param>
        /// <param name="strParentColumn">表中用于标记父记录的字段</param>
        /// <param name="strRootValue">第一层记录的父记录值(通常设计为0或者-1或者Null)用来表示没有父记录</param>
        /// <param name="strIndexColumn">索引字段,也就是放在DropDownList的Value里面的字段</param>
        /// <param name="strTextColumn">显示文本字段,也就是放在DropDownList的Text里面的字段</param>
        /// <param name="drpBind">需要绑定的DropDownList</param>
        /// <param name="i">用来控制缩入量的值,请输入-1</param>
        public static void MakeTree(DataTable dtNodeSets, string strParentColumn, string strRootValue, string strIndexColumn, string strTextColumn, DropDownList drpBind, int i)
        {
            //每向下一层,多一个缩入单位
            i++;

            DataView dvNodeSets = new DataView(dtNodeSets);
            dvNodeSets.RowFilter = strParentColumn + "=" + strRootValue;

            string strPading = "";  //缩入字符

            //通过i来控制缩入字符的长度,我这里设定的是一个全角的空格
            for (int j = 0; j < i; j++)
                strPading += " ";//如果要增加缩入的长度,改成两个全角的空格就可以了

            foreach (DataRowView drv in dvNodeSets)
            {
                TreeNode tnNode = new TreeNode();
                ListItem li = new ListItem(strPading + "├" + drv[strTextColumn].ToString(), drv[strIndexColumn].ToString());
                drpBind.Items.Add(li);
                MakeTree(dtNodeSets, strParentColumn, drv[strIndexColumn].ToString(), strIndexColumn, strTextColumn, drpBind, i);
            }

            //递归结束,要回到上一层,所以缩入量减少一个单位
            i--;
        }
 protected void ddlPolicyGroup_SelectedIndexChanged(object sender, EventArgs e)
 {
     ddlSchedule.Items.Clear();
     ddlStandard.Items.Clear();
     ddlQuery.SelectCommand = "SELECT DISTINCT ScheduleUID, ScheduleName FROM compiledpolicies WHERE PolicyGroupUID " + ddlPolicyGroup.SelectedValue.ToString() + " ORDER BY ScheduleName";
     //Response.Write("ddlSchedule ddlQuery.SelectCommand (ddlPolicyGroup_SelectedIndexChanged): " + ddlQuery.SelectCommand.ToString() + "<br>");
     SqlDataReader sqlReader = (SqlDataReader)ddlQuery.Select(DataSourceSelectArguments.Empty);
     if (sqlReader.HasRows)
     {
         while (sqlReader.Read())
         {
             ListItem item = new ListItem(sqlReader[1].ToString(), "= " + sqlReader[0].ToString(), true);
             ddlSchedule.Items.Add(item);
         }
     }
     ListItem scheduleall = new ListItem("Narrow results by schedule...", " != ''", true);
     scheduleall.Selected = true;
     ddlSchedule.Items.Add(scheduleall);
     ddlQuery.SelectCommand = "SELECT DISTINCT StandardUID, StandardName FROM compiledpolicies WHERE PolicyGroupUID " + ddlPolicyGroup.SelectedValue.ToString() + " AND ScheduleUID " + ddlSchedule.SelectedValue.ToString() + " ORDER BY StandardName";
     //Response.Write("ddlStandard ddlQuery.SelectCommand (ddlPolicyGroup_SelectedIndexChanged): " + ddlQuery.SelectCommand.ToString() + "<br>");
     sqlReader = (SqlDataReader)ddlQuery.Select(DataSourceSelectArguments.Empty);
     if (sqlReader.HasRows)
     {
         while (sqlReader.Read())
         {
             ListItem item = new ListItem(sqlReader[1].ToString(), "= " + sqlReader[0].ToString(), true);
             ddlStandard.Items.Add(item);
         }
     }
     ListItem standardall = new ListItem("Narrow results by schedule...", " != ''", true);
     standardall.Selected = true;
     ddlStandard.Items.Add(standardall);
 }
        protected override void OnPreRender(EventArgs e)
        {
            if ((lstLists.SelectedIndex > -1) & (!UpdateListProperties))
            {
                SelectedListId = new Guid(lstLists.SelectedValue);
            }

            lstLists.Items.Clear();
            SPWeb site = SPContext.Current.Web;
            foreach (SPList list in site.Lists)
            {
                ListItem listItem = new ListItem(list.Title, list.ID.ToString());
                lstLists.Items.Add(listItem);
            }

            // when the page reloads, default the selected item to the current list
            if (SelectedListId != Guid.Empty)
            {
                lstLists.Items.FindByValue(SelectedListId.ToString()).Selected = true;
            }

            if (UpdateListProperties)
            {
                SPList list = SPContext.Current.Web.Lists[SelectedListId];
                lblListTitle.Text = list.Title;
                lblListID.Text = list.ID.ToString().ToUpper();
                lblListIsDocumentLibrary.Text = (list is SPDocumentLibrary).ToString();
                lblListIsHidden.Text = list.Hidden.ToString();
                lblListItemCount.Text = list.ItemCount.ToString();
                lnkListUrl.Text = list.DefaultViewUrl;
                lnkListUrl.NavigateUrl = list.DefaultViewUrl;
            }
        }
        protected void dtgUsers_PreRender(object sender, EventArgs e)
        {
            if (dtgUsers.BottomPagerRow != null)
            {
                ((Label)dtgUsers.BottomPagerRow.FindControl("lbTotalPages")).Text = dtgUsers.PageCount.ToString();

                //This makes the first and last button disappear when on the first and last pages.
                ((LinkButton)dtgUsers.BottomPagerRow.FindControl("lbtnFirst")).Visible = dtgUsers.PageIndex != 0;
                ((LinkButton)dtgUsers.BottomPagerRow.FindControl("lbtnLast")).Visible = dtgUsers.PageCount != (dtgUsers.PageIndex + 1);

                DropDownList ddlistPageof = (DropDownList)dtgUsers.BottomPagerRow.FindControl("ddlPageItems");
                ddlistPageof.SelectedIndex = ddlistPageof.Items.IndexOf(ddlistPageof.Items.FindByValue(ViewState["DropDownPageItems"].ToString()));
                DropDownList ddlistPageno = (DropDownList)dtgUsers.BottomPagerRow.FindControl("ddlNumberPages");
                ddlistPageno.Items.Clear();
                for (int i = 1; i <= dtgUsers.PageCount; i++)
                {
                    ListItem liTemp = new ListItem();
                    liTemp.Text = i.ToString();
                    liTemp.Value = i.ToString();
                    ddlistPageno.Items.Add(liTemp);
                }
                if (dtgUsers.PageCount != 0)
                {
                    ddlistPageno.SelectedIndex = dtgUsers.PageIndex;
                    ddlistPageno.DataBind();
                }
            }
        }
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Label lblQuestion = new Label();
            _ddAnswer = new DropDownList();
            RequiredFieldValidator valQuestion = new RequiredFieldValidator();

            lblQuestion.ID = "lbl" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            _ddAnswer.ID = "dd" + _question.QuestionGuid.ToString().Replace("-", String.Empty);
            valQuestion.ID = "val" + _question.QuestionGuid.ToString().Replace("-", String.Empty);

            lblQuestion.Text = _question.QuestionText;
            lblQuestion.AssociatedControlID = _ddAnswer.ID;

            valQuestion.ControlToValidate = _ddAnswer.ID;
            valQuestion.Enabled = _question.AnswerIsRequired;

            _ddAnswer.Items.Add(new ListItem(Resources.SurveyResources.DropDownPleaseSelectText, String.Empty));

            foreach (QuestionOption option in _options)
            {
                ListItem li = new ListItem(option.Answer);
                if (li.Value == _answer) li.Selected = true;
                _ddAnswer.Items.Add(li);
            }

            valQuestion.Text = _question.ValidationMessage;

            Controls.Add(lblQuestion);
            Controls.Add(_ddAnswer);
            Controls.Add(valQuestion);
        }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User User = (User)Session["User"];
            if (User != null)
            {
                user_rank = User.RoleAsInt.ToString();
                user_id = User.ID.ToString();
            }

            <<<<<<< HEAD
            =======
            using (Dal.DB db = new Dal.DB())
            {
                var departments = (from d in db.Departments
                                   select d).ToList();
                foreach (var d in departments)
                {
                    ListItem item = new ListItem();
                    item.Text = d.Title;
                    item.Value = d.ID.ToString();
                    cbbDepartment.Items.Add(item);
                }
            }
            >>>>>>> 3aabe62cdccf29aead7c454a773c6bc3e00d87ab
        }
Example #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //DropDownList populated with one year ahead and 120 years past
            DropDownList ddlYear = (DropDownList)DetailsView1.FindControl("ddlYear");
            int curYear = DateTime.Now.Year;
            int newestYear = curYear + 1;

            ListItem tmpItem = new ListItem();

            tmpItem.Value = newestYear.ToString();
            tmpItem.Text = newestYear.ToString();

            ddlYear.Items.Add(tmpItem);

            for (int i = 1; i < 120; ++i)
            {

                ListItem tmp = new ListItem();
                tmp.Value = curYear.ToString();

                tmp.Text = curYear.ToString();

                ddlYear.Items.Add(tmp);

                curYear = DateTime.Now.AddYears(-i).Year;
            }
        }
Example #19
0
        protected void bindProductChklist()
        {
            int num = 0;
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MSSqlServer"].ConnectionString))
            {
                string commString = "select * from Product";
                using (SqlCommand comm = new SqlCommand())
                {
                    comm.CommandText = commString;
                    comm.Connection = conn;
                    conn.Open();
                    using (SqlDataReader sdr = comm.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            num++;

                            ListItem li = new ListItem();
                            li.Text = sdr["ProductName"].ToString();
                            li.Value = sdr["ProductID"].ToString();

                            this.chkList.Items.Add(li);
                        }
                    }
                }
            }
            if (num == 0)
            {
                this.lblProductInfo.Text = "当前数据库里面没有产品,请先添加产品!";
            }
        }
Example #20
0
        private void BindToList()
        {
            if (Page.IsPostBack) { return; }
            if (!pnlToAddresses.Visible) { return; }
            if (config.EmailAddresses == null) { return; }
            if (config.EmailAddresses.Count <= 1) { return; }

            List<string> bindList = new List<string>();
            int index = 0;
            foreach (string a in config.EmailAddresses)
            {
                if ((index + 1) <= config.EmailAliases.Count)
                {
                    bindList.Add(config.EmailAliases[index]);
                }
                else
                {
                    bindList.Add(a);
                }
                index += 1;
            }

            index = 0;
            foreach (string a in bindList)
            {
                ListItem item = new ListItem(a, index.ToInvariantString());
                ddToAddresses.Items.Add(item);
                index += 1;
            }
        }
Example #21
0
        public void populaLista()
        {
            rsPlay = objBD.ExecutaSQL("select PLI_ID, PLI_TITULO, PLI_URL from PlayList where PLI_ATIVO = 1 order by PLI_DH_CADASTRO desc");
            if (rsPlay == null)
            {
                throw new Exception();
            }
            if (rsPlay.HasRows)
            {
                while (rsPlay.Read())
                {
                    if (aux == 1)
                    {
                        objVideo.InnerHtml += "<iframe width=\"480\" height=\"269\" src=\""+rsPlay["PLI_URL"].ToString()+"\" frameborder=\"0\" allowfullscreen></iframe>";
                    }

                    System.Web.UI.WebControls.ListItem R = new System.Web.UI.WebControls.ListItem();
                    R.Value = rsPlay["PLI_ID"].ToString();
                    R.Text = rsPlay["PLI_TITULO"].ToString();
                    slPlayList.Items.Add(R);
                    aux++;
                }
            }
            rsPlay.Close();
            rsPlay.Dispose();
        }
Example #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Populate dependents list
                ListItem li = new ListItem("All", "0");
                ddlMembers.Items.Add(li);
                li = new ListItem(
                    String.Concat(ThisSession.FirstName, " ", ThisSession.LastName),
                    ThisSession.CCHID.ToString());
                ddlMembers.Items.Add(li);
                foreach (Dependent dep in ThisSession.Dependents)
                {
                    li = new ListItem(
                        String.Concat(dep.FirstName, " ", dep.LastName),
                        dep.CCHID.ToString());
                    ddlMembers.Items.Add(li);
                }

                lblPastCareDisclaimerText.Text = ThisSession.PastCareDisclaimerText.Trim();  //  lam, 20130418, MSF-299

                //Populate Past Care area
                SetupPastCare(0);
            }
        }
        private void Load_distric(int id)
        {
            var list = user.Loaddistric(id);
            if (list.Count > 0)
            {
                Drdistric.DataValueField = "PROP_ID";
                Drdistric.DataTextField = "PROP_NAME";
                Drdistric.DataSource = list;
                Drdistric.DataBind();
                ListItem l = new ListItem("---Chọn quận/huyện---", "0");
                l.Selected = true;
                Drdistric.Items.Insert(0, l);
            }
            else
            {
                DataTable dt = new DataTable("Newtable");

                dt.Columns.Add(new DataColumn("PROP_ID"));
                dt.Columns.Add(new DataColumn("PROP_NAME"));

                DataRow row = dt.NewRow();
                row["PROP_ID"] = 0;
                row["PROP_NAME"] = "---Chọn quận/huyện---";
                dt.Rows.Add(row);

                Drdistric.DataTextField = "PROP_NAME";
                Drdistric.DataValueField = "PROP_ID";
                Drdistric.DataSource = dt;
                Drdistric.DataBind();

            }
        }
Example #24
0
        private void ShowNews()
        {
            Maticsoft.BLL.NewsManage.News bll = new Maticsoft.BLL.NewsManage.News();
            DataSet Ds = bll.GetNewsList(MyintTop, MyClassId, false); //bll.GetTopScroll(4);//
            this.GridView1.DataSource = Ds;
            this.GridView1.DataBind();

            //处理记录信息 
            try
            {
                this.lblRowsCount.Text = Ds.Tables[0].Rows.Count.ToString();
            }
            catch { };

            this.PageDrop.Items.Clear();
            for (int i = 0; i < this.GridView1.PageCount; i++) 
            {
                ListItem dropitem = new ListItem();
                dropitem.Value = i.ToString();
                dropitem.Text = (i + 1).ToString();
                this.PageDrop.Items.Add(dropitem);
            }
            if(this.PageDrop.Items.Count>0)
            this.PageDrop.SelectedIndex = this.GridView1.PageIndex;
        }
Example #25
0
        public void LoadTree()
        {
            this.DropDownListTree.Items.Clear();

            DataSet ds = ProductClassManage.GetTree();

            if (ds.Tables["ProductClass"].Rows.Count == 0)
            {
                Response.Write("<script type='text/javascript'>alert('请先填加产品分类!');document.location.href='ProductClassAdd.aspx'</script>");
            }

            string strName = null;

            for (int i = 0; i < ds.Tables["ProductClass"].Rows.Count; i++)
            {
                strName = null;
                for (int j = 0; j < Convert.ToInt32(ds.Tables["ProductClass"].Rows[i]["depth"]); j++)
                {
                    strName = strName + (char)0xa0 + (char)0xa0 + (char)0xa0;
                }
                strName = strName + ">" + ds.Tables["ProductClass"].Rows[i]["pc_name"].ToString();

                ListItem li = new ListItem(strName, ds.Tables["ProductClass"].Rows[i]["pc_id"].ToString());

                this.DropDownListTree.Items.Insert(i, li);
            }
        }
        private void InitialDataBind()
        {
            DataSet ds;

            #region 绑定用户下拉列表
            string[] str = new string[3] { "AA", "AG", "PG" };

            User user = new User();

            this.ddlUser.Items.Clear();
            for (int i = 0; i < str.Length; i++)
            {
                ds = new DataSet();
                ds = user.GetUsersByType(str[i].ToString(), "");

                for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                {
                    string userID = ds.Tables[0].Rows[j]["UserID"].ToString();
                    string userName = ds.Tables[0].Rows[j]["UserName"].ToString();

                    ListItem li = new ListItem(userName, userID);
                    this.ddlUser.Items.Add(li);
                }

                ds.Dispose();
            }
            #endregion

            #region 绑定角色
            int userid = Convert.ToInt32(this.ddlUser.SelectedValue);
            FillSelectedRoleList(userid);
            FillAllRoleList(userid);
            #endregion
        }
        protected void BindDropDownLoaiTaiLieu()
        {
            ddlLoaiTaiLieu.Items.Clear();
            lbMessage.Text = "";
            ddlLoaiTaiLieu.Items.Add(new ListItem("", "-1"));
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString);
            con.Open();
            string sql = string.Format("select * from CV_DMLoaiTaiLieu");

            SqlCommand cmd = new SqlCommand(sql, con);
            SqlDataReader sdr = cmd.ExecuteReader();
            if (sdr.HasRows)
            {
                while (sdr.Read())
                {
                    int maloaitailieu = Convert.ToInt32(sdr.GetValue(sdr.GetOrdinal("MaLoaiTaiLieu")).ToString());
                    string tenloaitailieu = sdr.GetValue(sdr.GetOrdinal("TenLoaiTaiLieu")).ToString();
                    ListItem li = new ListItem();
                    li.Value = maloaitailieu.ToString();
                    li.Text = tenloaitailieu.ToString();
                    ddlLoaiTaiLieu.Items.Add(li);
                }
            }

        }
Example #28
0
        protected void BindSearchData()
        {
            // 单位
            string whereCondition = " [AuditingState]=2";
            List<CY.CSTS.Core.Business.UnitInfo> unitList = CY.CSTS.Core.Business.UnitInfo.SelectUnitInfosDynamic(whereCondition, "") as List<CY.CSTS.Core.Business.UnitInfo>;
            if (unitList != null)
            {
                ListItem li = new ListItem("请选择", "-1");
                ddlUnit.Items.Add(li);

                foreach (CY.CSTS.Core.Business.UnitInfo u in unitList)
                {
                    ListItem li2 = new ListItem(u.UnitName, u.Id.ToString());
                    ddlUnit.Items.Add(li2);
                }
            }

            // 仪器类别
            List<CY.CSTS.Core.Business.CLASSCODE> rootClassCode = CY.CSTS.Core.Business.CLASSCODE.GetSubClassCode(0) as List<CY.CSTS.Core.Business.CLASSCODE>;
            List<CY.CSTS.Core.Business.CLASSCODE> bigClassCode = new List<CY.CSTS.Core.Business.CLASSCODE>();
            foreach (CY.CSTS.Core.Business.CLASSCODE c in rootClassCode)
            {
                List<CY.CSTS.Core.Business.CLASSCODE> subClassCode = CY.CSTS.Core.Business.CLASSCODE.GetSubClassCode(c.Id).ToList();
                if (subClassCode != null)
                {
                    bigClassCode.AddRange(subClassCode);
                }
            }
            if (bigClassCode != null)
            {
                ddlMachineBigClass.DataSource = bigClassCode;
                ddlMachineBigClass.DataBind();
                ddlMachineBigClass.Items.Insert(0, new ListItem("请选择仪器类别", "0"));
            }
        }
        /// <summary>
        /// Displays the add/edit device dialog box.
        /// </summary>
        public void Show()
        {
            //If the validation failed, keep everything as is, and 
            //make sure the dialog stays visible.
            if (!Page.IsValid)
            {
                ModalDialog.Show();
                return;
            }

            if (Thread.CurrentPrincipal.IsInRole(ClearCanvas.ImageServer.Enterprise.Authentication.AuthorityTokens.Study.EditDataAccess) && Study != null)
            {
                AuthorityGroupCheckBoxList.Items.Clear();

                var controller = new StudyDataAccessController();
                var list = controller.ListDataAccessGroupsForStudy(Study.TheStudyStorage.Key);

                var adapter = new ServerPartitionDataAdapter();
                IList<AuthorityGroupDetail> accessAllStudiesList;
                var groups = adapter.GetAuthorityGroupsForPartition(Study.ThePartition.Key, true, out accessAllStudiesList);


                IList<ListItem> items = CollectionUtils.Map(
                    accessAllStudiesList,
                    delegate(AuthorityGroupDetail group)
                        {

                            var item = new ListItem(@group.Name,
                                                    @group.AuthorityGroupRef.ToString(false, false))
                                           {
                                               Enabled = false,
                                               Selected = true
                                           };
                            item.Attributes["title"] = @group.Description;
                            return item;
                        });

                foreach (var group in groups)
                {
                    var item = new ListItem(@group.Name,
                                              @group.AuthorityGroupRef.ToString(false, false));
                    item.Attributes["title"] = @group.Description;

                    foreach (AuthorityGroupStudyAccessInfo s in list)
                    {
                        if (s.AuthorityOID.Equals(group.AuthorityGroupRef.ToString(false, false)))
                            item.Selected = true;
                    }

                    items.Add(item);
                }

                AuthorityGroupCheckBoxList.Items.AddRange(CollectionUtils.ToArray(items));
            }

            CancelButton.Visible = true;
            UpdateButton.Visible = true;

            ModalDialog.Show();
        }
Example #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetAllNationalityInDropDownList();
                ListItem listItemNationality = new ListItem("Select nationality","-1");
                nationalityDropDownList.Items.Insert(0, listItemNationality);

                GetAllDepartmentInDropDownList();
                ListItem listItemDepartment = new ListItem("Select Department", "-1");
                departmentDropDownList.Items.Insert(0, listItemDepartment);

                GetAllGenderInDropDownList();
                ListItem listItemGender = new ListItem("Select gender", "-1");
                genderDropDownList.Items.Insert(0, listItemGender);

                GetAllYearTermInDropDownList();
                ListItem listItemYearTerm = new ListItem("Select year-term", "-1");
                yearTermDropDownList.Items.Insert(0, listItemYearTerm);

                GetAllSessionInDropDownList();
                ListItem listItemSession = new ListItem("Select session", "-1");
                sessionDropDownList.Items.Insert(0, listItemSession);

            }
        }