示例#1
0
 /// <summary>
 /// 绑定方法自定义
 /// </summary>
 /// <param name="dropdownlist">控件名称</param>
 /// <param name="dt">数据源</param>
 /// <param name="columeText">显示的文本</param>
 /// <param name="columnValue">隐藏在val里的值</param>
 /// <param name="columnParentsValue">mydata里的值</param>
 /// <param name="msg"></param>
 public void BindDdlParentsMore(HtmlSelect dropdownlist, DataTable dt, string columeText, string columnValue, string columnParentsValue, string msg)
 {
     if (dt.Rows.Count > 0)
     {
         dropdownlist.DataSource     = dt;
         dropdownlist.DataTextField  = columeText;
         dropdownlist.DataValueField = columnValue;
         dropdownlist.DataBind();
         dropdownlist.Items.Insert(0, new ListItem(msg, ""));
         for (int i = 1; i < dropdownlist.Items.Count; i++)
         {
             for (int j = 0; j < dt.Rows.Count; j++)
             {
                 string dd  = dropdownlist.Items[i].Value;
                 string ddd = dt.Rows[j][columnValue].ToString();
                 if (dropdownlist.Items[i].Value == dt.Rows[j][columnValue].ToString())//判断如果该行option的val值与dt的该行val值相等
                 {
                     dropdownlist.Items[i].Attributes["mydata"] = dt.Rows[j][columnParentsValue].ToString();
                     break;
                 }
             }
         }
     }
     else
     {
         dropdownlist.Items.Clear();
         dropdownlist.Items.Insert(0, new ListItem(msg, ""));
     }
 }
示例#2
0
        public static DataTable getselected_DataTable(HtmlSelect ddl)
        {
            DataTable  dt  = new DataTable();
            DataColumn val = new DataColumn("val", typeof(int));
            DataColumn txt = new DataColumn("txt", typeof(string));

            dt.Columns.Add(val);
            dt.Columns.Add(txt);

            // GET SELECTED ITEMS
            for (int i = 0; i <= ddl.Items.Count - 1; i++)
            {
                DataRow row = dt.NewRow();

                if (ddl.Items[i].Selected)
                {
                    row["val"] = Convert.ToInt32(ddl.Items[i].Value);
                    row["txt"] = ddl.Items[i].Text;

                    dt.Rows.Add(row);
                }
            }

            if (dt != null)
            {
                return(dt);
            }
            else
            {
                return(null);
            }
        }
示例#3
0
 public void PopulateCombo1(string sql, string textfiled, string valuefield, HtmlSelect combo)
 {
     DBopen();
     try
     {
         DA = new SqlDataAdapter(sql, con);
         DS = new DataSet();
         DA.Fill(DS);
         //combo.Items.Add(0, "Please Select");
         if (DS.Tables[0].Rows.Count > 0)
         {
             combo.DataSource     = DS;
             combo.DataTextField  = textfiled;
             combo.DataValueField = valuefield;
             combo.DataBind();
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
         DBClose();
     }
 }
示例#4
0
        public static void GetRealmList(ref HtmlSelect select, bool _IgnoreAny = false, int expansion = 0, bool _AllExpansion = false)
        {
            if (_AllExpansion)
            {
                int count = App.m_Server.Length + 1;
                if ((!_IgnoreAny && select.Items.Count == count) ||
                    (_IgnoreAny && select.Items.Count == count - 1))
                {
                    return;
                }
            }
            else
            {
                int count = App.m_Server.Count(x => x.Expansion == expansion) + 1;
                if ((!_IgnoreAny && select.Items.Count == count) ||
                    (_IgnoreAny && select.Items.Count == count - 1))
                {
                    return;
                }
            }
            select.Items.Clear();
            if (!_IgnoreAny)
            {
                select.Items.Add(new ListItem("Any realm", "0"));
            }

            for (int i = 1; i < App.m_Server.Length; ++i)
            {
                if (App.m_Server[i].Expansion == expansion)
                {
                    select.Items.Add(new ListItem(App.m_Server[i].Name, i.ToString()));
                }
            }
        }
示例#5
0
        public void Multiple()
        {
            HtmlSelect sel = new HtmlSelect();

            sel.Multiple = true;
            Assert.AreEqual(-1, sel.SelectedIndex, "SelectedIndex");
        }
示例#6
0
        public static bool Populate(HtmlSelect dropDownList, string stateCode,
                                    string countyCode, string firstEntry, string firstEntryValue,
                                    string selectedValue = null)
        {
            dropDownList.Items.Clear();

            // handle the optional first (default) entry
            if (firstEntry != null)
            {
                if (firstEntryValue == null)
                {
                    firstEntryValue = firstEntry;
                }
                dropDownList.AddItem(firstEntry, firstEntryValue,
                                     firstEntryValue == selectedValue);
            }

            var locals = GetNamesDictionary(stateCode, countyCode);

            if (locals.Count == 0)
            {
                return(false);
            }
            foreach (var local in locals.OrderBy(kvp => kvp.Value))
            {
                dropDownList.AddItem(local.Value, local.Key, local.Key == selectedValue);
            }
            return(true);
        }
    private void FillSelectedLists(UserControl_SystemCodeWUCtrl listOrigin, HtmlSelect listSelected, String strListValue)
    {
        System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(";");
        String[] strItemCollection = regex.Split(strListValue);
        System.Collections.Generic.List <String[, ]> strOptionCollection = new System.Collections.Generic.List <string[, ]>();
        String strScript = String.Empty;

        listSelected.Items.Clear();
        listOrigin.FetchSystemCodeListData();
        foreach (String strItem in strItemCollection)
        {
            foreach (ListItem item in listOrigin.Items)
            {
                if ((strItem.Length > 0) && item.Value.Equals(strItem))
                {
                    strOptionCollection.Add(new String[, ] {
                        { item.Value, item.Text }
                    });
                }
            }
        }

        strScript  = "var objList = document.forms[0]." + listSelected.ClientID + ", option;";
        strScript += "objList.length = 0;";
        foreach (String[,] tempString in strOptionCollection)
        {
            strScript += "option = document.createElement('OPTION');";
            strScript += "option.value = '" + tempString[0, 0] + "';";
            strScript += "option.text = '" + tempString[0, 1] + "';";
            strScript += "objList.options.add(option);";
        }

        ScriptManager.RegisterStartupScript(linkBtnLoad, linkBtnLoad.GetType(), Guid.NewGuid().ToString(), strScript, true);
    }
示例#8
0
        public static void FillSelectDictionary(ref HtmlSelect cboFill, bool IsNull, string DictionarySort, bool IsSearch)
        {
            cboFill.Items.Clear();

            if (IsSearch)
            {
                System.Web.UI.WebControls.ListItem sItem = new System.Web.UI.WebControls.ListItem("", "");
                cboFill.Items.Add(sItem);
            }

            if (IsNull)
            {
                System.Web.UI.WebControls.ListItem lItem = new System.Web.UI.WebControls.ListItem("", "");
                cboFill.Items.Add(lItem);
            }

            string sText, sData, sSign;

            DataTable dTable = GetDictionarySortList("", DictionarySort);

            foreach (DataRow DRow in dTable.Rows)
            {
                sData = DRow["DictionaryCode"].ToString();
                sText = DRow["DictionaryName"].ToString();
                sSign = DRow["DictionarySign"].ToString();
                if (sSign != "")
                {
                    sText = sText;
                }
                System.Web.UI.WebControls.ListItem lItem = new System.Web.UI.WebControls.ListItem(sText, sData);
                cboFill.Items.Add(lItem);
            }

            dTable.Dispose();
        }
示例#9
0
        public static bool Populate(HtmlSelect dropDownList, string stateCode, string firstEntry,
                                    string firstEntryValue, string selectedValue = null)
        {
            dropDownList.Items.Clear();

            // handle the optional first (default) entry
            if (firstEntry != null)
            {
                if (firstEntryValue == null)
                {
                    firstEntryValue = firstEntry;
                }
                dropDownList.AddItem(firstEntry, firstEntryValue,
                                     firstEntryValue == selectedValue);
            }

            if (IsNullOrWhiteSpace(stateCode))
            {
                return(false);
            }
            var counties = GetCountiesByState(stateCode);

            if (counties.Count == 0)
            {
                return(false);
            }
            foreach (var countyCode in counties)
            {
                dropDownList.AddItem(GetCountyName(stateCode, countyCode), countyCode,
                                     countyCode == selectedValue);
            }
            return(true);
        }
示例#10
0
    private HtmlSelect CreateSelect(Configuration.SearchInputFieldRow searchInputFieldRow)
    {
        HtmlSelect select = new HtmlSelect();

        using (OleDbCommand command = searchInputFieldRow.GetDatabaseCommand())
        {
            if (command.Parameters.Count > 0)
            {
                command.Parameters[0].Value = AppUser.GetRole();
            }

            using (OleDbDataAdapter adapter = new OleDbDataAdapter(command))
            {
                DataTable list = new DataTable();
                adapter.Fill(list);

                select.DataSource     = list;
                select.DataValueField = list.Columns[0].ColumnName;
                select.DataBind();
            }

            command.Connection.Dispose();
        }

        select.Items.Insert(0, new ListItem("", ""));
        return(select);
    }
示例#11
0
 /// <summary>
 /// 为DropDownList下拉框添加值
 /// </summary>
 /// <param name="select">下拉框控件的Id名称</param>
 /// <param name="ds">待添加的数据集</param>
 /// <param name="name">负值给下拉框内容的字段</param>
 /// <param name="value">负值给下拉框Value值的字段</param>
 public static void SelectItemsAdd(HtmlSelect select, DataSet ds, string name, string value)
 {
     foreach (DataRow row in ds.Tables[0].Rows)
     {
         select.Items.Add(new ListItem(row[name].ToString(), row[value].ToString()));
     }
 }
示例#12
0
        private void AddLanguageField(HtmlGenericControl container)
        {
            using (HtmlGenericControl field = new HtmlGenericControl("div"))
            {
                field.Attributes.Add("class", "field");

                using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.SelectLanguage, "LanguageSelect"))
                {
                    field.Controls.Add(label);
                }

                using (HtmlSelect languageSelect = new HtmlSelect())
                {
                    languageSelect.ID             = "LanguageSelect";
                    languageSelect.DataTextField  = "Text";
                    languageSelect.DataValueField = "Value";
                    languageSelect.DataSource     = this.GetLanguages();
                    languageSelect.DataBind();


                    field.Controls.Add(languageSelect);
                }
                container.Controls.Add(field);
            }
        }
示例#13
0
        private void CreateActionMenu(HtmlContainerControl menuContainer, IList <DataRow> responses,
                                      bool isNew)
        {
            menuContainer.Controls.Clear();
            new HtmlSpan {
                InnerText = "Select action:"
            }.AddTo(menuContainer);
            var dropdown = new HtmlSelect().AddTo(menuContainer);
            var edit     = dropdown.AddItem("Edit this response", "edit");
            var add      = dropdown.AddItem("Add another response to this question", "add");
            var view     = dropdown.AddItem("View or edit other responses to this question", "view");

            if (responses.Count == 0)
            {
                menuContainer.AddCssClasses("hidden");
            }
            else
            {
                menuContainer.RemoveCssClass("hidden");
            }
            if (isNew && responses.Count > 0)
            {
                edit.Attributes.Add("disabled", "disabled");
                add.Attributes.Add("selected", "selected");
            }
            else
            {
                edit.Attributes.Add("selected", "selected");
                if (responses.Count < 2)
                {
                    view.Attributes.Add("disabled", "disabled");
                }
            }
        }
示例#14
0
 protected override void InitializeSkin(Control skin)
 {
     Lab_MemLoginID      = (Label)skin.FindControl("Lab_MemLoginID");
     hid_Sex             = (HtmlInputHidden)skin.FindControl("hid_Sex");
     txt_UserName        = (HtmlInputText)skin.FindControl("txt_UserName");
     txt_PalyName        = (HtmlInputText)skin.FindControl("txt_PalyName");
     txt_Email           = (HtmlInputText)skin.FindControl("txt_Email");
     txt_Address         = (HtmlInputText)skin.FindControl("txt_Address");
     sel_Prov            = (HtmlSelect)skin.FindControl("sel_Prov");
     sel_City            = (HtmlSelect)skin.FindControl("sel_City");
     sel_Area            = (HtmlSelect)skin.FindControl("sel_Area");
     btn_Sure            = (Button)skin.FindControl("btn_Sure");
     btn_Save            = (Button)skin.FindControl("btn_Save");
     txt_QQ              = (HtmlInputText)skin.FindControl("txt_QQ");
     txt_Mobile          = (HtmlInputText)skin.FindControl("txt_Mobile");
     txt_Tel             = (HtmlInputText)skin.FindControl("txt_Tel");
     txt_WebSite         = (HtmlInputText)skin.FindControl("txt_WebSite");
     txt_Bth             = (HtmlInputText)skin.FindControl("txt_Bth");
     txt_Post            = (HtmlInputText)skin.FindControl("txt_Post");
     txt_Voc             = (HtmlInputText)skin.FindControl("txt_Voc");
     txt_Fax             = (HtmlInputText)skin.FindControl("txt_Fax");
     hid_AreaCode        = (HtmlInputHidden)skin.FindControl("hid_AreaCode");
     hid_AreaValue       = (HtmlInputHidden)skin.FindControl("hid_AreaValue");
     hid_CheckMobile     = (HtmlInputHidden)skin.FindControl("hid_CheckMobile");
     hid_CheckEmail      = (HtmlInputHidden)skin.FindControl("hid_CheckEmail");
     btn_Sure.Click     += btn_Sure_Click;
     btn_Save.Click     += btn_Save_Click;
     ImagePath           = (Image)skin.FindControl("ImagePath");
     StrMemLoginID       = base.MemLoginID;
     Lab_MemLoginID.Text = base.MemLoginID;
     if (!Page.IsPostBack)
     {
         method_0(StrMemLoginID);
     }
 }
示例#15
0
        private void AddSalesTypeField(HtmlGenericControl container)
        {
            using (HtmlGenericControl salesTypeDiv = HtmlControlHelper.GetField())
            {
                salesTypeDiv.ID = "SalesTypeDiv";
                salesTypeDiv.Attributes.Add("style", "width:200px");

                using (HtmlGenericControl field = HtmlControlHelper.GetField())
                {
                    using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.SalesType, "SalesTypeSelect"))
                    {
                        field.Controls.Add(label);
                    }

                    using (HtmlSelect salesTypeSelect = new HtmlSelect())
                    {
                        salesTypeSelect.ID             = "SalesTypeSelect";
                        salesTypeSelect.DataSource     = this.GetSalesTypes();
                        salesTypeSelect.DataTextField  = "Text";
                        salesTypeSelect.DataValueField = "Value";
                        salesTypeSelect.DataBind();

                        field.Controls.Add(salesTypeSelect);
                    }

                    salesTypeDiv.Controls.Add(field);
                }

                container.Controls.Add(salesTypeDiv);
            }
        }
示例#16
0
    public void PopulateCombo1(string sql, string TextField, string ValueField, HtmlSelect Combo)
    {
        DBOpen();
        try
        {
            DA = new SqlDataAdapter(sql, con);
            DS = new DataSet();
            DA.Fill(DS);
            Combo.Items.Add(new ListItem("Please Select", ""));
            if (DS.Tables[0].Rows.Count > 0)
            {
                Combo.DataSource = DS;

                Combo.DataTextField  = TextField;
                Combo.DataValueField = ValueField;
                Combo.DataBind();
            }
        }

        catch (Exception EX)
        {
        }

        finally
        {
            DBClose();
            DS.Dispose();
        }
    }
 protected override void CreateChildControls()
 {
     base.CreateChildControls();
     this.uploadControl            = new FileUploadControl();
     this.uploadControl.ID         = "UploadControl";
     this.uploadControl.ModuleName = this.moduleName;
     this.softSizeTextBox          = new TextBox();
     this.softSizeTextBox.ID       = "softSize";
     this.softSizeTextBox.ApplyStyleSheetSkin(this.Page);
     this.softSizeTextBox.Visible   = this.m_IsVisiableSoftSize;
     this.downLoadUrlSelect         = new HtmlSelect();
     this.downLoadUrlSelect.ID      = "DownLoadUrl";
     this.downLoadUrlSelect.Size    = 2;
     this.downLoadUrlSelect.Visible = this.m_IsVisibleDownLoadUrl;
     this.downLoadUrlSelect.ApplyStyleSheetSkin(this.Page);
     this.downLoadUrlSelect.Attributes.Add("style", "width: 417px; height: 90px");
     this.addUrlButton           = new HtmlButton();
     this.addUrlButton.ID        = "addUrl";
     this.addUrlButton.InnerText = "添加外部地址";
     this.addUrlButton.Visible   = this.m_IsVisibleDownLoadUrl;
     this.addUrlButton.ApplyStyleSheetSkin(this.Page);
     this.addUrlButton.Attributes.Add("onclick", "AddUrl();");
     this.modifyUrlButton           = new HtmlButton();
     this.modifyUrlButton.ID        = "modifyUrl";
     this.modifyUrlButton.InnerText = "修改当前地址";
     this.modifyUrlButton.ApplyStyleSheetSkin(this.Page);
     this.modifyUrlButton.Visible = this.m_IsVisibleDownLoadUrl;
     this.modifyUrlButton.Attributes.Add("onclick", "ModifyUrl();");
     this.deleteUrlButton           = new HtmlButton();
     this.deleteUrlButton.ID        = "deleteUrl";
     this.deleteUrlButton.InnerText = "删除当前地址";
     this.deleteUrlButton.ApplyStyleSheetSkin(this.Page);
     this.deleteUrlButton.Visible = this.m_IsVisibleDownLoadUrl;
     this.deleteUrlButton.Attributes.Add("onclick", "DeleteUrl();");
 }
示例#18
0
文件: Bind.cs 项目: yuhua1987113/scai
        /// <summary>
        /// 绑定下拉列表 sql 语句
        /// </summary>
        /// <param name="pSql">sql 语句</param>
        /// <param name="pHtmlSelect">HtmlSelect</param>
        /// <param name="pEditValue">修改时值</param>
        /// <param name="pFieldValue">值字段 如:ProID</param>
        /// <param name="pFieldText">内容字段 如:ProName</param>
        /// <param name="pFirstValue">第一项的值</param>
        /// <param name="pFirstText">第一项的内容</param>
        public static void BGHtmlSelect(string pSql, HtmlSelect pDropList, string pEditValue, string pFieldValue, string pFieldText, string pFirstValue, string pFirstText)
        {
            if (pFirstText.Length > 0)
            {
                pDropList.Items.Add(new ListItem(pFirstText, pFirstValue));
            }

            using (DataTable dt = DbHelp.GetDataTable(pSql))
            {
                foreach (DataRow dr in dt.Rows)
                {
                    System.Web.UI.WebControls.ListItem drlist = new ListItem();
                    drlist.Text  = dr[pFieldText].ToString();
                    drlist.Value = dr[pFieldValue].ToString();

                    if (pEditValue == drlist.Value)
                    {
                        drlist.Selected = true;
                    }

                    pDropList.Items.Add(drlist);
                }
                dt.Clear();
            }
        }
        protected override void OnPagePreRenderComplete(object sender, EventArgs e)
        {
            if (CurrentMode == ControlShowingMode.Dialog)
            {
                InitActivitiesListBox(_ActivitiesList);
                InitOpinionInputControl();

                HtmlTableRow reasonList = (HtmlTableRow)WebControlUtility.FindControlByHtmlIDProperty(this, "reasonList", true);

                if (reasonList != null)
                {
                    if (this.Reasons.Count > 0)
                    {
                        reasonList.Style["display"] = "inline";
                        HtmlSelect resonSelector = (HtmlSelect)WebControlUtility.FindControlByHtmlIDProperty(this, "resonSelector", true);

                        if (resonSelector != null)
                        {
                            foreach (var reason in this.Reasons)
                            {
                                resonSelector.Items.Add(new ListItem(reason.Description, reason.Key));
                            }
                        }
                    }
                }
            }

            base.OnPagePreRenderComplete(sender, e);
        }
示例#20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HtmlSelect select = new HtmlSelect {
                ID = "colorSelect2"
            };

            select.Items.Add(new ListItem {
                Text = "Red", Value = "red"
            });
            select.Items.Add(new ListItem {
                Text = "Green", Value = "green", Selected = true
            });
            select.Items.Add(new ListItem {
                Text = "Blue", Value = "blue"
            });
            container.Controls.Add(select);

            if (IsPostBack)
            {
                Debug.WriteLine(string.Format("colorSelect: {0}", colorSelect.Value));
                Debug.WriteLine(string.Format("colorSelect: {0}",
                                              colorSelect.Items[colorSelect.SelectedIndex].Text));
                Debug.WriteLine(string.Format("colorSelect2: {0}",
                                              Request.Form["colorSelect2"]));
            }
        }
        /// <summary>
        /// Verifies the selected option in thumbnail selector
        /// </summary>
        /// <param name="thumbnailOption">The thumbnail option.</param>
        public void VerifySelectedOptionThumbnailSelector(string thumbnailOption)
        {
            HtmlSelect selector = this.EM.Media.ImagePropertiesScreen.ThumbnailSelector
                                  .AssertIsPresent("Thumbnail selector");

            Assert.AreEqual(thumbnailOption, selector.SelectedOption.Text);
        }
示例#22
0
        private HtmlGenericControl PrepareRowValueForSelect(string sectionClass, string rowName, int witem, ListItem[] items)
        {
            var rowDiv = new HtmlGenericControl("div");

            rowDiv.Attributes.Add("class", "row");
            var section = new HtmlGenericControl("section");

            section.Attributes.Add("class", sectionClass);

            var label = new HtmlGenericControl("label");

            label.Attributes.Add("class", "input");
            label.InnerText = rowName;

            var select = new HtmlSelect()
            {
                Name = rowName.ToLower() + "-" + witem.ToString(), ID = rowName.ToLower() + "-" + witem.ToString()
            };

            select.Attributes.Add("class", "form-control");
            select.Items.AddRange(items);
            if (_formMode == FormMode.ViewMode)
            {
                select.Disabled = true;
                select.Style.Add("background-color", "#EBEBE4");
            }
            label.Controls.Add(select);
            section.Controls.Add(label);

            rowDiv.Controls.Add(section);

            return(rowDiv);
        }
 protected void btnsave_Click(object sender, EventArgs e)
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         objmysqldb.OpenSQlConnection();
         objmysqldb.BeginSQLTransaction();
         int Emp_id = 0;
         int.TryParse(ddlemplist.Items[ddlemplist.SelectedIndex].Value.ToString(), out Emp_id);
         foreach (GridViewRow row in grd.Rows)
         {
             Label      date     = (Label)row.FindControl("lbldate");
             Label      pre_type = (Label)row.FindControl("lbltype");
             HtmlSelect ddlgrp   = (HtmlSelect)row.FindControl("ddlstatus");
             string     status   = ddlgrp.Value.ToString();
         }
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("Employee_Attendance_Override 420: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.CloseSQlConnection();
         objmysqldb.disposeConnectionObj();
     }
 }
示例#24
0
    //根据传入的FileUpload控件
    public string SaveFile(FileUpload Fu, HtmlSelect Hs)
    {
        //StringBuilder js =new StringBuilder( @"<script type='text/javascript'>alert('')</script>");
        //int ci = js.ToString().LastIndexOf("\'");
        int    cl  = Fu.PostedFile.ContentLength;
        string ft  = Fu.PostedFile.FileName.Trim();
        string fe  = ft.Substring(ft.LastIndexOf(".") + 1).ToLower();
        string Msg = "";

        if (!Fu.HasFile)
        {
            Msg = "欲上传的文件路径不正确";
        }
        else
        {
            if (fe != "jpg")
            {
                Msg = "请上传jpg格式的图片";
            }
            else if (3072 > cl || cl > 50 * 1024)
            {
                Msg = "文件大小须在3~50k以内<a href='file://172.2.1.100/网络公司/' target='_blank'>如何优化图像?</a>";
            }
            else
            {
                SaveImgs(this.TargetPath(Hs) + "\\" + (this.DC(Hs.Value) + 1).ToString() + ".jpg");
                Msg = "图片上传成功";
            }
        }
        return(Msg);
    }
示例#25
0
        public void Visit(HtmlSelect h)
        {
            sb.Append(Tabs(h.Depth));
            sb.Append(string.Format("<{0}", h.Tag));

            foreach (var a in h.Attributes.Where(a => a.IsSet))
            {
                sb.Append(a);
            }

            foreach (var e in h.Events.Where(e => e.IsSet))
            {
                sb.Append(e);
            }

            sb.AppendLine(">");

            foreach (var c in h.Contents)
            {
                Visit(c);
            }

            sb.Append(Tabs(h.Depth));
            sb.AppendLine(string.Format("</{0}>", h.Tag));
        }
示例#26
0
 /// <summary>
 /// 数据列表绑定
 /// </summary>
 /// <param name="slt">列表对象</param>
 public void Bind(HtmlSelect slt)
 {
     slt.DataSource     = this.EnumList;
     slt.DataTextField  = "Name";
     slt.DataValueField = "Num";
     slt.DataBind();
 }
        public void TestMethod_lockToInactive()
        {
            readData();

            CommonFunctions.Login(myManager, _username, _password, _Url);

            myManager.ActiveBrowser.Window.Maximize();

            // -- End of Login ---
            ObjMenus menus = new ObjMenus(myManager);

            HtmlListItem system = menus.systemlink.As <HtmlListItem>();

            system.MouseHover();

            myManager.ActiveBrowser.RefreshDomTree();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            HtmlAnchor users = menus.userslink.As <HtmlAnchor>();

            users.MouseClick();

            Thread.Sleep(2000);
            myManager.ActiveBrowser.RefreshDomTree();

            ObjActiveDeactive objactive     = new ObjActiveDeactive(myManager);
            ObjUnlockUser     objunlockuser = new ObjUnlockUser(myManager);
            ObjEditUser       objedit       = new ObjEditUser(myManager);

            // Search locked users
            HtmlSelect status = objunlockuser.searchstatus.As <HtmlSelect>();

            status.MouseClick();
            Thread.Sleep(1000);
            status.SelectByText(_searchstatus, true);

            Thread.Sleep(2000);

            //HtmlTable casattable = objunlockuser.usertable.As<HtmlTable>();
            //Assert.AreEqual(casattable.BodyRows[0].Cells[7].InnerText, _searchstatus);

            Thread.Sleep(2000);

            HtmlInputCheckBox check1 = objunlockuser.rowcheck1.As <HtmlInputCheckBox>();

            check1.Check(true);
            Thread.Sleep(2000);

            Element edit = objunlockuser.editbtn;

            myManager.ActiveBrowser.Actions.Click(edit);

            Thread.Sleep(2000);

            deactiveuser();
            verifyDectivation();
            loginTodeactivateUser();
        }
示例#28
0
 public static void SetHtmlSelect(HtmlSelect list)
 {
     list.DataSource     = GetDataTable();
     list.DataTextField  = "Name";
     list.DataValueField = "Value";
     list.DataBind();
 }
示例#29
0
        public static void Populate(HtmlSelect dropDownList, string firstEntry,
                                    string firstEntryValue, string selectedValue = null, bool clear = true)
        {
            if (clear)
            {
                dropDownList.Items.Clear();
            }

            // handle the optional first (default) entry
            if (firstEntry != null)
            {
                if (firstEntryValue == null)
                {
                    firstEntryValue = firstEntry;
                }
                dropDownList.AddItem(firstEntry, firstEntryValue,
                                     firstEntryValue == selectedValue);
            }

            // Add all real states (plus DC)
            foreach (var si in StateList)
            {
                if (si.IsState)
                {
                    dropDownList.AddItem(si.Name, si.StateCode, si.StateCode == selectedValue);
                }
            }
        }
示例#30
0
        public void Big()
        {
            HtmlSelect sel = new HtmlSelect();

            sel.Size = 5;
            Assert.AreEqual(-1, sel.SelectedIndex, "SelectedIndex");
        }
示例#31
0
 /// <summary>
 /// Adds search criteria to a Query if the search control is not empty
 /// </summary>
 /// <param name="queryDefinition">The query to add the criteria to</param>
 /// <param name="column">The column to search on</param>
 /// <param name="comparisionMethod">The type of search to perform</param>
 /// <param name="searchControl">The search control that has the criteria</param>
 protected void AddToQuery(Query queryDefinition, Enum column, Comparison comparisionMethod, HtmlSelect searchControl)
 {
     if (searchControl.Value.Length > 0)
         {
             queryDefinition.And(Criteria.Create(column, Condition.Is, comparisionMethod, System.Xml.XmlConvert.ToBoolean(searchControl.Value)));
         }
 }
示例#32
0
 public static HtmlSelect GetHtmlSelect(string sltName, Dictionary<object, object> aSltElement, bool aRunServer)
 {
     HtmlSelect slt = new HtmlSelect();
     slt.ID = sltName;
     slt.Name = sltName;
     if (aRunServer)
     {
         slt.Attributes.Add("runat", "server");
     }
     object[] items = new object[aSltElement.Keys.Count];
     aSltElement.Keys.CopyTo(items, 0);
     for (int i = 0; i < items.Length; i++)
     {
         ListItem oListItem = new ListItem();
         oListItem.Text = items[i].ToString();
         object tmpParamValue = null;
         if (aSltElement.TryGetValue(items[i], out tmpParamValue))
         {
             oListItem.Value = Convert.ToString(tmpParamValue);
         }
         else
         {
             throw new Exception();
         }
         slt.Items.Add(oListItem);
     }
     return slt;
 }
    public HtmlSelect VratiDanokLista(string Vrednost)
    {

        HtmlSelect lista = new HtmlSelect();

        lista.Items.AddRange(ListaParovi("Danok").ToArray());

        lista.SelectedIndex = lista.Items.IndexOf(lista.Items.FindByText(Vrednost));

        return lista;
    }
示例#34
0
    /// <summary>
    /// Reads the query string to populate a 
    /// yes/no search criteria control
    /// </summary>
    /// <param name="fieldName">The name of the parameter in the query string that has the search criteria</param>
    /// <param name="searchControl">The control to populate with the search criteria</param>
    /// <returns>zero if no criteria was found, or one if criteria is specified</returns>
    protected int LoadSearchBoolean(string fieldName, HtmlSelect searchControl)
    {
        if (HasQueryStringParameter(fieldName))
            {
                string SearchValue = Request.QueryString[fieldName];

                if ((SearchValue != null && SearchValue.Length > 0) || AllowSearchAll)
                {
                    searchControl.Value = SearchValue;

                    return 1;
                }
            }

            return 0;
    }
    private void checkedCheckList(string condition, string id, HtmlSelect control)
    {
        //ListItem li;

        //if (string.IsNullOrEmpty(id))
        //{
        //    li = control.Items.FindByText(condition);

        //    if (li != null)
        //    {
        //        li.Selected = true;
        //    }
        //}
        //else
        //{
        //    control.Value = id;
        //}

    }
示例#36
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // EntityFactory.CheckEntityAndDB("WEC");
        if (Request["preUrl"] != null)
        {
            preUrl = Request["preUrl"];
        }
        //系统帐套
        if (MyConfigurationSettings.GetValue<string>("CloudSystem")=="1")
        {
            if (DataBase.Factory(BasePage.cloudConn).Exist("A8Account"))
            {
                A8Account val = new A8Account();
                List<A8Account> list1 = BLLTable<A8Account>.Factory(BasePage.cloudConn).Select(val);
                if (list1.Count > 0)
                {
                    HtmlSelect sel1 = new HtmlSelect();
                    sel1.Items.AddRange(FormHelper.GetListItem(A8Account.Attribute.ConnectStr, A8Account.Attribute.ConnectStr, A8Account.Attribute.FullName));
                    //sel1.InnerHtml;
                }
            }
        }
        //系统皮肤
        SYS_THEME theme = BLLTable<SYS_THEME>.Factory(conn).GetRowData(SYS_THEME.Attribute.THEME_NAME, _ThemeName);
        if (theme != null && !string.IsNullOrEmpty(theme.LOGIN_HTML))
        {
            Literal lll = new Literal();

            if (Request.Cookies["SYS_USER_USER_NAME"] != null)
            {
                name = Request.Cookies["SYS_USER_USER_NAME"].Value;
            }
            if (MyDebugger.IsAttached)//调试时加快速度
            {
                theme.LOGIN_HTML = theme.LOGIN_HTML.Replace("<%=name %>", "sys");
                theme.LOGIN_HTML = theme.LOGIN_HTML.Replace("name=\"password\"", "name=\"password\" value='123456'");
            }
            theme.LOGIN_HTML = theme.LOGIN_HTML.Replace("<%=name %>", name);

            //原模版有个脚本错误,屏蔽此问题
            //ie下密码为明文
            theme.LOGIN_HTML = theme.LOGIN_HTML.Replace("name=\"password\" type=\"text\"", "name=\"password\" type=\"password");

            lll.Text = theme.LOGIN_HTML;
            phLogin.Controls.Add(lll);

            string appPath = WebHelper.GetAppPath();
            HtmlLink css = new HtmlLink();
            css.Href = appPath + "Themes/" + _ThemeName + "/index.css";
            css.Attributes.Add("rel", "stylesheet");
            css.Attributes.Add("type", "text/css");

            this.Page.Header.Controls.Add(css);

            if (AgileFrame.Core.MyConfigurationSettings.GetValue("User_IsRunMode") == "Developer")
            {
                css = new HtmlLink();
                css.Href = appPath + "Themes/" + _ThemeName + "/dev_index.css";
                css.Attributes.Add("rel", "stylesheet");
                css.Attributes.Add("type", "text/css");
                this.Page.Header.Controls.Add(css);
            }
        }
        else
        {
            phLogin.Controls.Add(TemplateControl.LoadControl("~/Themes/" + _ThemeName + "/Login.ascx"));
        }

        //string strIdentity = User.Identity.Name;
        //if (!string.IsNullOrEmpty(strIdentity))
        //{
        //    SYS_USER user = new SYS_USER();
        //    user = BLLTable<SYS_USER>.Factory(conn).GetRowData(SYS_USER.Attribute.USER_NAME, strIdentity);
        //    if (user != null)
        //    {
        //        bool tostaff = PowerHelper.SetCurLoginUser(user);
        //        if (tostaff == true)
        //        {
        //            Response.Redirect("Index.aspx");
        //        }
        //        else
        //        {
        //            AgileFrame.Core.ScriptHelper.Alert(Page, "您的用户未与员工信息关联,请联系管理员处理。");
        //        }
        //    }
        //}
        //if (MyDebugger.IsAttached)
        //{
        //    Response.Redirect("LoginBack.aspx?username=sys&password=123456");
        //}
    }
示例#37
0
  private HtmlSelect CreateSelect(Configuration.SearchInputFieldRow searchInputFieldRow)
  {
    HtmlSelect select = new HtmlSelect();

    using (OleDbCommand command = searchInputFieldRow.GetDatabaseCommand())
    {
      if (command.Parameters.Count > 0)
      {
        command.Parameters[0].Value = AppUser.GetRole();
      }

      using (OleDbDataAdapter adapter = new OleDbDataAdapter(command))
      {
        DataTable list = new DataTable();
        adapter.Fill(list);

        select.DataSource = list;
        select.DataValueField = list.Columns[0].ColumnName;
        select.DataBind();
      }

      command.Connection.Dispose();
    }

    select.Items.Insert(0, new ListItem("", ""));
    return select;
  }