コード例 #1
0
ファイル: AlertUtils.cs プロジェクト: windygu/.net-wms
 public static void Build(System.Web.UI.WebControls.ListItemCollection items, AlertConst alertConst)
 {
     items.Clear();
     items.Add(new ListItem(alertConst.GetName(AlertLevel_Old.Severity), AlertLevel_Old.Severity));
     items.Add(new ListItem(alertConst.GetName(AlertLevel_Old.Important), AlertLevel_Old.Important));
     items.Add(new ListItem(alertConst.GetName(AlertLevel_Old.Primary), AlertLevel_Old.Primary));
 }
コード例 #2
0
 private void @__BuildControl__control5(System.Web.UI.WebControls.ListItemCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.ListItem @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control6();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.ListItem @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control7();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.ListItem @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control8();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.ListItem @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control9();
     @__ctrl.Add(@__ctrl4);
     global::System.Web.UI.WebControls.ListItem @__ctrl5;
     @__ctrl5 = this.@__BuildControl__control10();
     @__ctrl.Add(@__ctrl5);
     global::System.Web.UI.WebControls.ListItem @__ctrl6;
     @__ctrl6 = this.@__BuildControl__control11();
     @__ctrl.Add(@__ctrl6);
     global::System.Web.UI.WebControls.ListItem @__ctrl7;
     @__ctrl7 = this.@__BuildControl__control12();
     @__ctrl.Add(@__ctrl7);
     global::System.Web.UI.WebControls.ListItem @__ctrl8;
     @__ctrl8 = this.@__BuildControl__control13();
     @__ctrl.Add(@__ctrl8);
     global::System.Web.UI.WebControls.ListItem @__ctrl9;
     @__ctrl9 = this.@__BuildControl__control14();
     @__ctrl.Add(@__ctrl9);
     global::System.Web.UI.WebControls.ListItem @__ctrl10;
     @__ctrl10 = this.@__BuildControl__control15();
     @__ctrl.Add(@__ctrl10);
 }
コード例 #3
0
ファイル: AlertUtils.cs プロジェクト: windygu/.net-wms
 public static void Build(System.Web.UI.WebControls.ListItemCollection items, AlertConst alertConst)
 {
     items.Clear();
     items.Add(new ListItem(alertConst.GetName(AlertStatus_Old.Unhandled), AlertStatus_Old.Unhandled));
     items.Add(new ListItem(alertConst.GetName(AlertStatus_Old.Observing), AlertStatus_Old.Observing));
     items.Add(new ListItem(alertConst.GetName(AlertStatus_Old.Handling), AlertStatus_Old.Handling));
     items.Add(new ListItem(alertConst.GetName(AlertStatus_Old.Closed), AlertStatus_Old.Closed));
 }
コード例 #4
0
 private void @__BuildControl__control2(System.Web.UI.WebControls.ListItemCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.ListItem @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control3();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.ListItem @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control4();
     @__ctrl.Add(@__ctrl2);
 }
コード例 #5
0
ファイル: VatSelectList.cs プロジェクト: lulzzz/BrandStore
        /// <summary>
        /// Initializes the datasource
        /// </summary>
        /// <param name="datasource"></param>
        protected override void InitializeDataSource(System.Web.UI.WebControls.ListItemCollection datasource)
        {
            String msg2 = AppLogic.GetString("setvatsetting.aspx.3", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
            String msg3 = AppLogic.GetString("setvatsetting.aspx.4", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);

            datasource.Add(new ListItem(msg2, ((int)VATSettingEnum.ShowPricesInclusiveOfVAT).ToString()));
            datasource.Add(new ListItem(msg3, ((int)VATSettingEnum.ShowPricesExclusiveOfVAT).ToString()));

            this.SelectedValue = ((int)ThisCustomer.VATSettingRAW).ToString();
        }
コード例 #6
0
        public void LoadStatusList2DDL(string selected_value)
        {
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Active", "1"));
            lstColl.Add(new ListItem("InActive", "0"));

            rdlDiscontinued.DataSource = lstColl;
            rdlDiscontinued.DataTextField = "Text";
            rdlDiscontinued.DataValueField = "Value";
            rdlDiscontinued.DataBind();
            rdlDiscontinued.SelectedValue = selected_value;
         
        }
コード例 #7
0
        protected void LoadControlTypeList2DDL()
        {
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Tab", "1"));
            lstColl.Add(new ListItem("Module", "2"));

            ddlControlType.DataSource = lstColl;
            ddlControlType.DataTextField = "Text";
            ddlControlType.DataValueField = "Value";
            ddlControlType.DataBind();
            ddlControlType.Items.Insert(0, new ListItem("- Chọn -", "0"));
            ddlControlType.SelectedIndex = 0;
        }
コード例 #8
0
        protected void LoadStatus2DDL()
        {
            //Load list item to dropdownlist
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Active", "1"));
            lstColl.Add(new ListItem("InActive", "0"));

            ddlStatus.DataSource = lstColl;
            ddlStatus.DataTextField = "Text";
            ddlStatus.DataValueField = "Value";
            ddlStatus.DataBind();
            ddlStatus.AutoPostBack = true;
        }
コード例 #9
0
 public static void Build(System.Web.UI.WebControls.ListItemCollection items, string alerttype, AlertConst alertconst)
 {
     items.Clear();
     if (alerttype == BenQGuru.eMES.AlertModel.AlertType_Old.First || alerttype == BenQGuru.eMES.AlertModel.AlertType_Old.ResourceNG)
     {
         items.Add(new ListItem(alertconst.GetName(BenQGuru.eMES.AlertModel.Operator_Old.GE), BenQGuru.eMES.AlertModel.Operator_Old.GE));
     }
     else
     {
         items.Add(new ListItem("介于", BenQGuru.eMES.AlertModel.Operator_Old.BW));
         items.Add(new ListItem(alertconst.GetName(BenQGuru.eMES.AlertModel.Operator_Old.LE), BenQGuru.eMES.AlertModel.Operator_Old.LE));
         items.Add(new ListItem(alertconst.GetName(BenQGuru.eMES.AlertModel.Operator_Old.GE), BenQGuru.eMES.AlertModel.Operator_Old.GE));
     }
 }
コード例 #10
0
        protected void LoadDiscontinued2DDL()
        {
            //Load list item to dropdownlist
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Hiện", "1"));
            lstColl.Add(new ListItem("Ẩn", "0"));

            ddlDiscontinued.DataSource = lstColl;
            ddlDiscontinued.DataTextField = "Text";
            ddlDiscontinued.DataValueField = "Value";
            ddlDiscontinued.DataBind();
            ddlDiscontinued.SelectedIndex = 0; // Select the first item
            ddlDiscontinued.AutoPostBack = true;
        }
コード例 #11
0
        public void LoadDomainGroup2RadioBtnList()
        {
            ListItemCollection lst = new ListItemCollection();
            lst.Add(new ListItem("Tên miềm phổ biến", "1"));
            lst.Add(new ListItem("Tên miềm Việt Nam", "2"));
            lst.Add(new ListItem("Tên miềm Việt Nam theo địa giới hành chính", "3"));
            lst.Add(new ListItem("Tên miềm Quốc Tế", "4"));      

            rdlDomainGroup.Items.Clear();            
            rdlDomainGroup.DataSource = lst;
            rdlDomainGroup.DataBind();
            rdlDomainGroup.SelectedIndex = 0;
            rdlDomainGroup.AutoPostBack = true;
        }
コード例 #12
0
        protected void LoadStatus2RadioBtnList(string selected_value)
        {
            //Load list item to dropdownlist
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Published", "2"));
            lstColl.Add(new ListItem("Active", "1"));
            lstColl.Add(new ListItem("InActive", "0"));

            rdlStatus.DataSource = lstColl;
            rdlStatus.DataTextField = "Text";
            rdlStatus.DataValueField = "Value";
            rdlStatus.DataBind();
            rdlStatus.SelectedValue = selected_value;
            rdlStatus.AutoPostBack = false;
        }
コード例 #13
0
        protected void LoadStatus2DDL()
        {
            //Load list item to dropdownlist
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Active", "1"));
            lstColl.Add(new ListItem("InActive", "0"));

            ddlStatus.DataSource = lstColl;
            ddlStatus.DataTextField = "Text";
            ddlStatus.DataValueField = "Value";
            ddlStatus.DataBind();
            ddlStatus.Items.Insert(0, new ListItem("Chọn trạng thái", "")); // add the new item at the top of the list
            ddlStatus.SelectedIndex = 1; // Select the first item
            ddlStatus.AutoPostBack = true;
        }
コード例 #14
0
 protected ListItem[] GetItemsConSeleccioneTodosMol(System.Collections.Generic.List <Common.SolutionEntityFramework.BaseSolutionEntity> Source, string DataTextField, string DataValueField)
 {
     System.Web.UI.WebControls.DropDownList ddl = new DropDownList();
     ddl.DataSource     = Source;
     ddl.DataTextField  = DataTextField;
     ddl.DataValueField = DataValueField;
     ddl.DataBind();
     System.Web.UI.WebControls.ListItemCollection lista1 = new System.Web.UI.WebControls.ListItemCollection();
     lista1.Add(new System.Web.UI.WebControls.ListItem("Seleccione...", "0"));
     lista1.Add(new System.Web.UI.WebControls.ListItem("Todos", "-2"));
     System.Web.UI.WebControls.ListItem[] lista2 = new System.Web.UI.WebControls.ListItem[ddl.Items.Count + 2];
     lista1.CopyTo(lista2, 0);
     ddl.Items.CopyTo(lista2, 2);
     return(lista2);
 }
コード例 #15
0
 private void @__BuildControl__control10(System.Web.UI.WebControls.ListItemCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.ListItem @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control11();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.ListItem @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control12();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.ListItem @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control13();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.ListItem @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control14();
     @__ctrl.Add(@__ctrl4);
 }
コード例 #16
0
        public static ListItemCollection BuildListFromEnum(Enum objEnum)
        {
            ListItemCollection colListItems = new ListItemCollection();
            ListItem liItem;

            SortedList colSortedListItems = new SortedList();

            foreach (int value in Enum.GetValues(objEnum.GetType()))
            {
                liItem = new ListItem();

                liItem.Value = value.ToString();
                liItem.Text = StringEnum.GetStringValue((Enum)Enum.Parse(objEnum.GetType(), value.ToString(), true));

                if (liItem.Text != string.Empty)
                {
                    colSortedListItems.Add(liItem.Text, liItem);
                }
                liItem = null;
            }

            foreach (ListItem liListItem in colSortedListItems.GetValueList())
            {
                colListItems.Add(liListItem);
            }

            return colListItems;
        }
コード例 #17
0
    public static void LoadListItems(System.Web.UI.WebControls.ListItemCollection list, IDataReader rdr, string textField, string valField, string selectedValue, bool closeReader)
    {
        ListItem l;
        string   sText = "";
        string   sVal  = "";

        list.Clear();

        while (rdr.Read())
        {
            sText = rdr[textField].ToString();
            sVal  = rdr[valField].ToString();

            l = new ListItem(sText, sVal);
            if (selectedValue != string.Empty)
            {
                if (selectedValue.ToLower() == sVal.ToLower())
                {
                    l.Selected = true;
                }
            }
            list.Add(l);
        }
        if (closeReader)
        {
            rdr.Close();
        }
    }
コード例 #18
0
          protected void Page_Load(object sender, EventArgs e)
          {
              if (!IsPostBack)
              {

                  DataSet ds = objTransferPackageTimings.GetAllTrasferpackageDescription(int.Parse(Request.QueryString["ID"].ToString()));
                  GridView1.DataSource = ds;
                  GridView1.DataBind();


                  foreach (GridViewRow item in GridView1.Rows)
                  {
                      Label lblfromTOid = (Label)item.FindControl("lbltp_detialid");
                      Label lblFlag = (Label)item.FindControl("lblFlag");
                      DDL1 = (MulticheckDropdown)item.FindControl("DDL1");
                      DataSet ds1 = objTransferPackageTimings.GetAallTimings();

                      //DataSet DsMealDate = objHotelStoreProcedure.getALLdateFORmEAL(txtpty_CheckIn.Text, txtpty_CheckOut.Text);
                      ListItemCollection list = new ListItemCollection();
                      for (int i1 = 0; i1 < ds1.Tables[0].Rows.Count; i1++)
                      {
                          ListItem listitem = new ListItem(Convert.ToString(ds1.Tables[0].Rows[i1]["TIME"]), Convert.ToString(ds1.Tables[0].Rows[i1]["TIME"]));
                          list.Add(listitem);

                      }
                      DDC1.DDList.DataSource = list;
                      DDC1.DDList.DataTextField = "Text";
                      DDC1.DDList.DataValueField = "Value";
                      DDC1.DDList.DataBind();


                      DataSet ds11 = objTransferPackageTimings.GetAllTrasferpackageTimmings(int.Parse(lblfromTOid.Text), lblFlag.Text, "SIC");

                      if (ds11.Tables[0].Rows.Count != 0)
                      {

                          ListItemCollection list2 = new ListItemCollection();
                          for (int j = 0; j < ds11.Tables[0].Rows.Count; j++)
                          {
                              for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                              {
                                  if (ds1.Tables[0].Rows[i]["TIME"].ToString() == ds11.Tables[0].Rows[j]["AutoSearchResult"].ToString())
                                  {
                                      setchk = setchk + "," + Convert.ToString(ds11.Tables[0].Rows[j]["AutoSearchResult"].ToString());
                                  }

                              }

                          }

                          setchk = setchk.Substring(1);
                          DDC1.SetCheckBoxValues(setchk);
                          setchk = "";
                      }

                  }

              }

          }
コード例 #19
0
        private void BindLotteryMaintenanceNavigation()
        {
            //notes:    set up collection of list items
            ListItemCollection navigationList = new ListItemCollection();

            //notes:    set local variables and set default values
            bool isLotteryLookupLinkable = true;

            string lotteryLookupQueryString = string.Empty;

            switch (this.CurrentNavigationLink)
            {
                case LotteryMaintenanceNavigation.LotteryLookup:
                    isLotteryLookupLinkable = false;
                    break;

            }

            //notes:    add each item to the collection
            navigationList.Add(new ListItem { Text = "Lottery Game Lookup", Value = "/LotteryMaintenance/Default/aspx", Enabled = isLotteryLookupLinkable });

            //notes:    bind list object to front-end control
            LotteryMaintenanceNavigationList.DataSource = navigationList;
            LotteryMaintenanceNavigationList.DataBind();
        }
コード例 #20
0
ファイル: TranslatedPage.cs プロジェクト: GramozKrasniqi/HRMS
 private ListItemCollection GetListItemsFromEnum(int languageId, Type enumType)
 {
     // container to be returned
     ListItemCollection items = new ListItemCollection();
     // break down the enumerator items into key/value pairs
     string[] names = Enum.GetNames(enumType);
     Array values = Enum.GetValues(enumType);
     // piece together the key/pairs into the listitem collection
     items.Add(new ListItem("Please select", ""));
     for (int i = 1; i <= names.Length - 1; i++)
     {
         items.Add(new ListItem(TranslateApplicationString(languageId, names[i]), i.ToString()));
     }
     // return it
     return items;
 }
コード例 #21
0
ファイル: CommonFunc.cs プロジェクト: kingofhawks/kcsj
 public static void BindListItem(ListItemCollection LIC, DataView DataSource, string TextField, string ValueField)
 {
     LIC.Clear();
     for (int i = 0; i < DataSource.Count; i++)
     {
         LIC.Add(new ListItem(DataSource[i][TextField].ToString(), DataSource[i][ValueField].ToString()));
     }
 }
コード例 #22
0
        public void BindLotteryNavigation()
        {
            // Instantiates new list item collection
            ListItemCollection navigationList = new ListItemCollection();

            // sets variables and sets their default values
            bool isGame = true;
            bool isWinningNumbers = true;
            bool isPrizeOddsOfWinning = true;
            string gameIdQueryString = "GameId=" + this.GameId.ToString();

            //Switch case for deactivating the hyperlinks
            if (this.GameId > 0)
            {
                switch (this.CurrentNavigationLink)
                {
                    case LotteryNavigation.Game:
                        isGame = false;
                        break;
                    case LotteryNavigation.WinningNumbers:
                        isWinningNumbers = false;
                        break;
                    case LotteryNavigation.Prizes:
                        isPrizeOddsOfWinning = false;
                        break;
                }
            }
            else
            {
                //If no employee id exists set all links to inactive
                isGame = false;
                isWinningNumbers = false;
                isPrizeOddsOfWinning = false;
            }

            // add each item to the collection
            navigationList.Add(new ListItem { Text = "Game", Value = "/GameSection/Game.aspx?" + gameIdQueryString, Enabled = isGame });
            navigationList.Add(new ListItem { Text = "Winning Numbers", Value = "/GameSection/WinningNumbers.aspx?" + gameIdQueryString, Enabled = isWinningNumbers });
            navigationList.Add(new ListItem { Text = "Prizes", Value = "/GameSection/Prizes.aspx?" + gameIdQueryString, Enabled = isPrizeOddsOfWinning });

            // bind list objects to front-end control
            LotteryNavigationList.DataSource = navigationList;
            LotteryNavigationList.DataBind();
        }
        private void BindTableMaintenanceNavigation()
        {
            ListItemCollection navigationList = new ListItemCollection();

            bool isEntityLookUpLinkable = true;
            bool isClientLookupLinkable = true;
            bool isVehicleMakeModelLinkable = true;
            bool isVehicleLinkable = true;

            string entityLookupQueryString = string.Empty;
            string vehicleMakeModelQueryString = string.Empty;

            switch( this.CurrentNavigationLink)
            {

                case TableMaintenanceNavigation.EntityLookup:
                    isEntityLookUpLinkable = false;
                    break;

                case TableMaintenanceNavigation.Client:
                    isClientLookupLinkable = false;
                    break;

                case TableMaintenanceNavigation.VehicleMakeModel:
                    isVehicleMakeModelLinkable = false;
                    break;

                case TableMaintenanceNavigation.Vehicle:
                    isVehicleLinkable = false;
                    break;
            }

            navigationList.Add(new ListItem { Text = "Entity Type Lookup", Value = "/TableMaintenance/Default.aspx", Enabled = isEntityLookUpLinkable });
            navigationList.Add(new ListItem { Text = "Client Info", Value = "/TableMaintenance/Client.aspx", Enabled = isClientLookupLinkable});
            navigationList.Add(new ListItem { Text = "Vehicle Make & Model", Value = "/TableMaintenance/VehicleMakeModel.aspx", Enabled = isVehicleMakeModelLinkable });
            navigationList.Add(new ListItem { Text = "Aston Vehicles", Value = "/TableMaintenance/Vehicles.aspx", Enabled = isVehicleLinkable});

            TableMaintenanceNavigationList.DataSource = navigationList;
            TableMaintenanceNavigationList.DataBind();
        
        }
コード例 #24
0
 //绑定学期标识下拉列表
 public void DataBindSearchTermTagList(ListItemCollection itemCollection)
 {
     DalOperationAboutCourses doac = new DalOperationAboutCourses();
     DataTable dt = doac.FindAllTermTags().Tables[0];
     string termTag = null;
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         termTag = dt.Rows[i]["termTag"].ToString().Trim();
         ListItem li = new ListItem(CommonUtility.ChangeTermToString(termTag), termTag);
         itemCollection.Add(li);
     }
 }
コード例 #25
0
		public void Methods ()
		{
			ListItemCollection	c;
			ListItem		i;
			ListItem		i2;

			c = new ListItemCollection();
			Assert.AreEqual (0, c.Count, "T1");

			i = new ListItem("Item 1", "10");
			c.Add(i);
			Assert.AreEqual (1, c.Count, "T2");

			i = new ListItem("This is item 2", "20");
			c.Add(i);
			Assert.AreEqual (2, c.Count, "T3");

			Assert.AreEqual (null, c.FindByText(" is "), "T4");
			Assert.AreEqual (i.Text, c.FindByText("This is item 2").Text, "T5");
			Assert.AreSame (i, c.FindByText("This is item 2"), "T6");
			Assert.AreEqual (1, c.IndexOf(c.FindByText("This is item 2")), "T7");
			Assert.AreEqual (1, c.IndexOf(c.FindByValue("20")), "T8");

			i = new ListItem("Item 3", "30");
			Assert.IsFalse(c.Contains(i), "T9");
			c.Add(i);
			Assert.IsTrue(c.Contains(i), "T10");

			i = new ListItem("Forth", "40");
			i2 = new ListItem("Fifth", "50");
			c.AddRange(new ListItem[] {i, i2});
			Assert.AreEqual (5, c.Count, "T11");

			c.RemoveAt(1);
			Assert.AreEqual (4, c.Count, "T12");
			Assert.AreEqual (null, c.FindByText("This is item 2"), "T13");

			c.Clear();
			Assert.AreEqual (0, c.Count, "T13");
		}
コード例 #26
0
        public static ListItemCollection CreateListCollectionOfNumbers(int Low, int High)
        {
            ListItemCollection colNumbersList = new ListItemCollection();

            for (int i = Low; i <= High; i++)
            {
                string strNumber = i.ToString();
                ListItem objNumberItem = new ListItem(strNumber, strNumber);
                colNumbersList.Add(objNumberItem);
            }

            return colNumbersList;
        }
コード例 #27
0
ファイル: SalaryView.aspx.cs プロジェクト: skyaspnet/usta
 //绑定学期标识下拉列表
 public void DataBindSearchTermTagList(ListItemCollection itemCollection, string termValue)
 {
     itemCollection.Clear();
     DalOperationAboutCourses doac = new DalOperationAboutCourses();
     DataTable dt = doac.FindAllTermTags().Tables[0];
     string termTag = null;
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         termTag = dt.Rows[i]["termTag"].ToString().Trim();
         ListItem li = new ListItem(CommonUtility.ChangeTermToString(termTag), termTag);
         if (termValue == li.Value)
         {
             li.Selected = true;
         }
         itemCollection.Add(li);
     }
     ListItem itemAll = new ListItem("全部学期", "all");
     if ("all" == termValue) {
         itemAll.Selected = true;
     }
     itemCollection.Add(itemAll);
 }
コード例 #28
0
        public void PopulateIsSecureList2DDL()
        {
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("Admin Menu", "True"));
            lstColl.Add(new ListItem("Front Menu", "False"));

            ddlIsSecure.DataSource = lstColl;
            ddlIsSecure.DataTextField = "Text";
            ddlIsSecure.DataValueField = "Value";
            ddlIsSecure.DataBind();
            ddlIsSecure.SelectedIndex = 0; // Select the first item 
            ddlIsSecure.AutoPostBack = true;
        }
コード例 #29
0
 public static void FillToListBox(ListItemCollection lstItems, DataTable source, int rootId, bool superUser)
 {
     DataRow[] drCommands = source.Select("CommandParentID = " + rootId);
     foreach(DataRow row in drCommands)
     {
         if (!superUser && (bool)row["IsSuperUser"]) continue;
         ListItem rootItem = new ListItem(row["CommandName"].ToString(), row["CommandID"].ToString());
         rootItem.Attributes.Add("Level","0");
         lstItems.Add(rootItem);
         LoadForCurListItem(lstItems, rootItem, source, superUser);
     }
     lstItems.Insert(0, new ListItem("Root","0"));
 }
コード例 #30
0
ファイル: MiscUtility.cs プロジェクト: haoas/CRMTPE
 public static void FillTreeData(ListItemCollection lst, DataTable dtCommands, string fieldKey, string fieldName, string fieldParentID, string sortBy)
 {
     lst.Clear();
     DataRow[] drRoots = dtCommands.Select(fieldParentID + "  = " + 0, sortBy);
     foreach (DataRow row in drRoots)
     {
         ListItem item = new ListItem();
         item.Value = row[fieldKey].ToString();
         item.Text = row[fieldName].ToString();
         item.Attributes.Add("Level", "0");
         lst.Add(item);
         LoadCmdItem(lst, item, dtCommands, fieldKey, fieldName, fieldParentID, sortBy);
     }
 }
コード例 #31
0
ファイル: Functions.cs プロジェクト: evgeniynet/DataLayer
        public static void CreateHoursList(ListItemCollection ListItems, SortDirection direction)
        {
            int from = 0, to = 23, step = 1;
            if (direction == SortDirection.Descending)
            {
                from = 23; to = 0; step = -1;
            }

            if (Micajah.Common.Security.UserContext.Current.TimeFormat == 0) //AM/PM time format
            {
                for (int i = from; (direction == SortDirection.Ascending && i <= to) || (direction == SortDirection.Descending && i >= to); i += step)
                    if (i < 12)
                        ListItems.Add(new ListItem(i.ToString() + "am", i.ToString()));
                    else if (i > 12)
                        ListItems.Add(new ListItem((i - 12).ToString() + "pm", i.ToString()));
                    else
                        ListItems.Add(new ListItem(i.ToString() + "noon", i.ToString()));

                ListItems.FindByValue("0").Text = "12am";
            }
            else
                for (int i = from; (direction == SortDirection.Ascending && i <= to) || (direction == SortDirection.Descending && i >= to); i += step) ListItems.Add(new ListItem(FormatTimePart(i), i.ToString()));
        }
コード例 #32
0
        protected ListItem[] GetItemsConSeleccioneObj(System.Collections.Generic.List <object> Source, string DataTextField, string DataValueField)
        {
            System.Web.UI.WebControls.DropDownList ddl = new DropDownList();
            ddl.DataSource     = Source;
            ddl.DataTextField  = DataTextField;
            ddl.DataValueField = DataValueField;
            ddl.DataBind();
            System.Web.UI.WebControls.ListItemCollection lista1 = new System.Web.UI.WebControls.ListItemCollection();
            lista1.Add(new System.Web.UI.WebControls.ListItem("Seleccione...", "0"));

            System.Web.UI.WebControls.ListItem[] lista2 = new System.Web.UI.WebControls.ListItem[ddl.Items.Count + 1];
            lista1.CopyTo(lista2, 0);
            ddl.Items.CopyTo(lista2, 1);
            return(lista2);
        }
コード例 #33
0
 protected void btnCheckStorage_Click(object sender, EventArgs e)
 {
     ListItemCollection chosenRecipe = new ListItemCollection();
     if (ddlChosenRecipe.Items.Count > 0)
     {
         foreach (ListItem cR in ddlChosenRecipe.Items)
         {
             chosenRecipe.Add(cR);
         }
     }
     myConnection.Close(); //closing connection
     Session["chosenRecipe"] = chosenRecipe;
     Session["portion"] = portion;
     Response.Redirect("ShoppingList.aspx");
 }
コード例 #34
0
 protected void btnConfirmPlannedMeal_Click(object sender, EventArgs e)
 {
     if (lbChosenRecipe.Items.Count != 0)
     {
         if (txtDate.Text != "")
         {
             int portion = Convert.ToInt32(ddlPortion.SelectedValue);
             ListItemCollection chosenRecipe = new ListItemCollection();
             OleDbCommand command = new OleDbCommand("INSERT INTO PlannedMeal(UserDataID, Portion, CreatedDate) VALUES(@UserDataID, @Portion, @CreatedDate)", myConnection);
             OleDbCommand command2 = new OleDbCommand("Select @@Identity", myConnection);
             command.CommandType = CommandType.Text;
             command2.CommandType = CommandType.Text;
             //adding parameters with value
             command.Parameters.AddWithValue("@UserDataID", userid.ToString());
             command.Parameters.AddWithValue("@Portion", portion.ToString());
             command.Parameters.AddWithValue("@CreatedDate", txtDate.Text.ToString());
             command.ExecuteNonQuery(); //executing query
             command2.ExecuteNonQuery(); //executing query
             int plannedMealID = Convert.ToInt32(command2.ExecuteScalar());
             if (lbChosenRecipe.Items.Count > 0)
             {
                 foreach (ListItem cr in lbChosenRecipe.Items)
                 {
                     chosenRecipe.Add(cr);
                     int recipeID = Convert.ToInt32(cr.Value);
                     OleDbCommand insertCommand = new OleDbCommand("INSERT INTO PlannedMealRecipe(PlannedMealID, RecipeID) VALUES(@PlannedMealID, @RecipeID)", myConnection);
                     insertCommand.CommandType = CommandType.Text;
                     //adding parameters with value
                     insertCommand.Parameters.AddWithValue("@PlannedMealID", plannedMealID.ToString());
                     insertCommand.Parameters.AddWithValue("@RecipeID", recipeID.ToString());
                     insertCommand.ExecuteNonQuery();  //executing query
                 }
             }
             myConnection.Close(); //closing connection
             Session["chosenRecipe"] = chosenRecipe;
             Session["portion"] = portion;
             Response.Redirect("ShoppingList.aspx");
         }
         else
         {
             lblCheckChosenRecipe.Text = "Please choose a date";
         }
     }
     else
     {
         lblCheckChosenRecipe.Text = "Please choose an recipe";
     }
 }
コード例 #35
0
ファイル: CommonEnum.cs プロジェクト: kingofhawks/kcsj
 /// <summary>
 /// 绑定控件的ListItem项
 /// </summary>
 /// <param name="LIC"></param>
 /// <param name="IsFistNull"></param>
 public void InitListItems(ListItemCollection LIC, bool IsFistNull)
 {
     if (LIC.Count > 0)
     {
         LIC.Clear();
     }
     Hashtable ht = GetTextValue();
     foreach (DictionaryEntry de in ht)
     {
         LIC.Add(new ListItem(de.Value.ToString(), de.Key.ToString()));
     }
     if (IsFistNull)
     {
         LIC.Insert(0, "");
     }
 }
コード例 #36
0
ファイル: OrganizationDataBinder.cs プロジェクト: hkiaipc/yh
 /// <summary>
 /// 
 /// </summary>
 /// <param name="wu"></param>
 /// <param name="ddl"></param>
 public static void DataBind(WaterUserClass wu, DropDownList ddlChannel)
 {
     ListItemCollection ds = new ListItemCollection();
     foreach (ChannelClass c in wu.ChannelCollection)
     {
         string id = c.ChannelID.ToString();
         string name = c.ChannelName;
         ListItem li = new ListItem();
         li.Text = name;
         li.Value = id;
         ds.Add(li);
     }
     ddlChannel.DataTextField = "Text";
     ddlChannel.DataValueField = "Value";
     ddlChannel.DataSource = ds;
     ddlChannel.DataBind();
 }
コード例 #37
0
ファイル: Setting.aspx.cs プロジェクト: valendo/MyCMS
 private void GetListPages(List<PageInfo> pages, ref ListItemCollection list, int level)
 {
     string space = "";
     for (int i = 0; i < level; i++)
     {
         space += spaceChar;
     }
     foreach (var item in pages)
     {
         list.Add(new ListItem(Server.HtmlDecode(space + item.PageName.ToString()), item.PageId.ToString()));
         var subPages = db.Pages.Where(t => t.ParentId == item.PageId).ToList();
         if (subPages.Count > 0)
         {
             GetListPages(subPages, ref list, level + 1);
         }
     }
 }
コード例 #38
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary == null)
                throw new ArgumentNullException("dictionary");

            if (type == typeof(ListItemCollection))
            {
                // Create the instance to deserialize into.
                ListItemCollection list = new ListItemCollection();

                // Deserialize the ListItemCollection's items.
                ArrayList itemsList = (ArrayList)dictionary["List"];
                for (int i=0; i<itemsList.Count; i++)
                    list.Add(serializer.ConvertToType<ListItem>(itemsList[i]));

                return list;
            }
            return null;
        }
コード例 #39
0
        protected void LoadPaneList2DDL()
        {
            ListItemCollection lstColl = new ListItemCollection();
            lstColl.Add(new ListItem("ContentPane", "ContentPane"));
            lstColl.Add(new ListItem("Banner", "Banner"));
            lstColl.Add(new ListItem("DivContainer", "DivContainer"));
            lstColl.Add(new ListItem("TopPane", "TopPane"));
            lstColl.Add(new ListItem("LeftPane", "LeftPane"));
            lstColl.Add(new ListItem("RightPane", "RightPane"));
            lstColl.Add(new ListItem("BottomPane", "BottomPane"));

            ddlPaneName.DataSource = lstColl;
            ddlPaneName.DataTextField = "Text";
            ddlPaneName.DataValueField = "Value";
            ddlPaneName.DataBind();
            ddlPaneName.Items.Insert(0, new ListItem("- Chọn -", "0"));
            ddlPaneName.SelectedIndex=0;
        }
コード例 #40
0
    public static void LoadListItems(System.Web.UI.WebControls.ListItemCollection list, DataTable tblBind, DataTable tblVals, string textField, string valField)
    {
        ListItem l;

        for (int i = 0; i < tblBind.Rows.Count; i++)
        {
            l = new ListItem(tblBind.Rows[i][textField].ToString(), tblBind.Rows[i][valField].ToString());

            DataRow dr;
            for (int x = 0; x < tblVals.Rows.Count; x++)
            {
                dr = tblVals.Rows[x];
                if (dr[valField].ToString().ToLower().Equals(l.Value.ToLower()))
                {
                    l.Selected = true;
                }
            }
            list.Add(l);
        }
    }
コード例 #41
0
        /// <summary>
        /// Retira o setor da unidade selecionada
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnClick_RetiraSetor(object sender, ImageClickEventArgs e)
        {
            if (CustomValidator_Retirar.IsValid)
            {
                ListItemCollection ltemp = new ListItemCollection();

                foreach (ListItem i in ListBox_SetoresAlocados.Items)
                {
                    if (i.Selected)
                        ltemp.Add(i);
                }

                foreach (ListItem i in ltemp)
                {
                    ListBox_SetoresAlocados.Items.Remove(i);
                    ListBox_SetoresDisponiveis.Items.Add(i);
                }

                ListBox_SetoresAlocados.DataBind();
                ListBox_SetoresDisponiveis.DataBind();
            }else
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('Para remover um ou mais setores da unidade deve-se selecionar os registros na lista de setores incluídos.');", true);
        }
コード例 #42
0
 private void @__BuildControl__control22(System.Web.UI.WebControls.ListItemCollection @__ctrl)
 {
     global::System.Web.UI.WebControls.ListItem @__ctrl1;
     @__ctrl1 = this.@__BuildControl__control23();
     @__ctrl.Add(@__ctrl1);
     global::System.Web.UI.WebControls.ListItem @__ctrl2;
     @__ctrl2 = this.@__BuildControl__control24();
     @__ctrl.Add(@__ctrl2);
     global::System.Web.UI.WebControls.ListItem @__ctrl3;
     @__ctrl3 = this.@__BuildControl__control25();
     @__ctrl.Add(@__ctrl3);
     global::System.Web.UI.WebControls.ListItem @__ctrl4;
     @__ctrl4 = this.@__BuildControl__control26();
     @__ctrl.Add(@__ctrl4);
     global::System.Web.UI.WebControls.ListItem @__ctrl5;
     @__ctrl5 = this.@__BuildControl__control27();
     @__ctrl.Add(@__ctrl5);
     global::System.Web.UI.WebControls.ListItem @__ctrl6;
     @__ctrl6 = this.@__BuildControl__control28();
     @__ctrl.Add(@__ctrl6);
     global::System.Web.UI.WebControls.ListItem @__ctrl7;
     @__ctrl7 = this.@__BuildControl__control29();
     @__ctrl.Add(@__ctrl7);
     global::System.Web.UI.WebControls.ListItem @__ctrl8;
     @__ctrl8 = this.@__BuildControl__control30();
     @__ctrl.Add(@__ctrl8);
     global::System.Web.UI.WebControls.ListItem @__ctrl9;
     @__ctrl9 = this.@__BuildControl__control31();
     @__ctrl.Add(@__ctrl9);
     global::System.Web.UI.WebControls.ListItem @__ctrl10;
     @__ctrl10 = this.@__BuildControl__control32();
     @__ctrl.Add(@__ctrl10);
     global::System.Web.UI.WebControls.ListItem @__ctrl11;
     @__ctrl11 = this.@__BuildControl__control33();
     @__ctrl.Add(@__ctrl11);
     global::System.Web.UI.WebControls.ListItem @__ctrl12;
     @__ctrl12 = this.@__BuildControl__control34();
     @__ctrl.Add(@__ctrl12);
 }
コード例 #43
0
        protected internal override void PerformDataBinding(IEnumerable dataSource)
        {
            if (dataSource == null)
            {
                goto setselected;
            }
            if (!AppendDataBoundItems)
            {
                Items.Clear();
            }

            string format = DataTextFormatString;

            if (format.Length == 0)
            {
                format = null;
            }

            string text_field  = DataTextField;
            string value_field = DataValueField;

            if (text_field.Length == 0)
            {
                text_field = null;
            }
            if (value_field.Length == 0)
            {
                value_field = null;
            }

            ListItemCollection coll = Items;

            foreach (object container in dataSource)
            {
                string text;
                string val;

                text = val = null;
                if (text_field != null)
                {
                    text = DataBinder.GetPropertyValue(container, text_field, format);
                }

                if (value_field != null)
                {
                    val = DataBinder.GetPropertyValue(container, value_field).ToString();
                }
                else if (text_field == null)
                {
                    text = val = container.ToString();
                    if (format != null)
                    {
                        text = String.Format(format, container);
                    }
                }
                else if (text != null)
                {
                    val = text;
                }

                if (text == null)
                {
                    text = val;
                }

                coll.Add(new ListItem(text, val));
            }

setselected:
            if (!String.IsNullOrEmpty(_selectedValue))
            {
                if (!SetSelectedValue(_selectedValue))
                {
                    throw new ArgumentOutOfRangeException("value", String.Format("'{0}' has a SelectedValue which is invalid because it does not exist in the list of items.", ID));
                }
                if (_selectedIndex >= 0 && _selectedIndex != SelectedIndex)
                {
                    throw new ArgumentException("SelectedIndex and SelectedValue are mutually exclusive.");
                }
            }
            else if (_selectedIndex >= 0)
            {
                SelectedIndex = _selectedIndex;
            }
        }
コード例 #44
0
ファイル: AlertUtils.cs プロジェクト: windygu/.net-wms
        public static void Build(string alerttype, System.Web.UI.WebControls.ListItemCollection items, AlertConst alertConst)
        {
            items.Clear();

            if (alerttype == AlertType_Old.NG)
            {
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.SS), AlertItem_Old.SS));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Model), AlertItem_Old.Model));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Resource), AlertItem_Old.Resource));
            }
            else if (alerttype == AlertType_Old.PPM || alerttype == AlertType_Old.CPK)
            {
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item));
            }
            else if (alerttype == AlertType_Old.DirectPass)
            {
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.SS), AlertItem_Old.SS));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Segment), AlertItem_Old.Segment));
            }
            else if (alerttype == AlertType_Old.First)
            {
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item));
            }
            else if (alerttype == AlertType_Old.ResourceNG)
            {
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item));
            }
            else if (alerttype == AlertType_Old.Manual)
            {
            }
            else
            {
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Item), AlertItem_Old.Item));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.SS), AlertItem_Old.SS));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Model), AlertItem_Old.Model));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Segment), AlertItem_Old.Segment));
                items.Add(new ListItem(alertConst.GetName(AlertItem_Old.Resource), AlertItem_Old.Resource));
            }
        }