protected void Page_Load(object sender, EventArgs e) { try { this.Master.name.Text = Session["User"].ToString(); } catch (Exception ex) { Response.Redirect("index.aspx"); } lblSent.Visible = false; if (!IsPostBack) { if (Session["getme"] != null) { Label1.Text = ""; ddPerson.Visible = false; ddReciever.Visible = false; } ListItemCollection lic = new ListItemCollection(); lic.Insert(0, new ListItem("Select Person", "-1")); lic.Insert(1, new ListItem("To Administrator", "Admin")); lic.Insert(2, new ListItem("To Student", "-3")); ddPerson.DataSource = lic; ddPerson.DataValueField = "value"; ddPerson.DataTextField = "Text"; ddPerson.DataBind(); } }
public static ListItemCollection BindYear() { ListItemCollection items = new ListItemCollection(); int startYear = Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings["MudarStartYear"]); int currentYear = DateTime.Now.Year; //for (int count = 0; count < Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings["SeasonYearCount"].ToString()); count++) //{ // ListItem item = new ListItem(); // item.Text = (Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings["SeasonStartYear"].ToString()) + count).ToString(); // item.Value = (Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings["SeasonStartYear"].ToString()) + count).ToString(); // items.Add(item); //} while (startYear <= currentYear) { ListItem item = new ListItem(); item.Text = startYear.ToString(); item.Value = startYear.ToString(); items.Add(item); startYear++; } items.Insert(0, AddListItemWithDefaultValueNotSelected()); return(items); }
public ListItemCollection OpcionNula(ListItemCollection ItemCollection) { ListItem Item = new ListItem(" Seleccionar ", "0"); if (!ItemCollection.Contains(Item)) { ItemCollection.Insert(0, Item); } return(ItemCollection); }
public new void Insert(int index, object item) { if (item is ListItem) { base.Insert(index, item); owner.Insert(index, (ListItem)item); } else { throw new ArgumentException("The Add method only accept ListItem objects."); } }
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")); }
/// <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, ""); } }
private void BindNomineeRelation() { ListItemCollection items = new ListItemCollection() { new ListItem { Text = "Father", Value = "Father" }, new ListItem { Text = "Mother", Value = "Mother" }, new ListItem { Text = "Husband", Value = "Husband" }, new ListItem { Text = "Wife", Value = "Wife" }, new ListItem { Text = "Son", Value = "Son" }, new ListItem { Text = "Daughter", Value = "Daughter" }, new ListItem { Text = "Brother", Value = "Brother" }, new ListItem { Text = "Sister", Value = "Sister" } }; items.Insert(0, new ListItem { Text = "--Select--", Value = string.Empty, Selected = false }); foreach (ListItem item in items) { ddlNomineeDetails.Items.Add(item); } ddlNomineeDetails.DataBind(); ddlNomineeDetails.SelectedValue = "--Select--"; GetAdmissionNumber(); }
private void BindNomineeRelation(bool isPostback = false) { DDLitems = new ListItemCollection() { new ListItem { Text = "Father", Value = "Father" }, new ListItem { Text = "Mother", Value = "Mother" }, new ListItem { Text = "Husband", Value = "Husband" }, new ListItem { Text = "Wife", Value = "Wife" }, new ListItem { Text = "Son", Value = "Son" }, new ListItem { Text = "Daughter", Value = "Daughter" }, new ListItem { Text = "Brother", Value = "Brother" }, new ListItem { Text = "Sister", Value = "Sister" } }; DDLitems.Insert(0, new ListItem { Text = "--Select--", Value = string.Empty, Selected = false }); foreach (ListItem item in DDLitems) { ddlNomineeRelationTDA.Items.Add(item); } ddlNomineeRelationTDA.DataBind(); ddlNomineeRelationTDA.SelectedValue = "--Select--"; }
private void GetTenureDetails() { var tenureList = TermDepositApplicationBL.GetTenureDetails(); ListItemCollection ddlTenureList = new ListItemCollection(); foreach (var item in tenureList) { ListItem _item = new ListItem() { Text = item.TenureName, Value = item.RateOfIntrest.ToString() }; ddlTenureList.Add(_item); } ddlTenureList.Insert(0, new ListItem { Text = "--Select--", Value = string.Empty, Selected = false }); foreach (ListItem item in ddlTenureList) { ddlTenure.Items.Add(item); } ddlTenure.DataBind(); ddlTenure.SelectedValue = "--Select--"; GetDepositeNumber(); }
private ListItemCollection GetRoles() { // Lets populate thbe Usergroups into Collection RoleController roleController = new RoleController(); ArrayList colArrayList = roleController.GetPortalRoles(PortalId); // Create a ListItemCollection to hold the Roles ListItemCollection colRoles = new ListItemCollection(); // Add all defined Roles to the List foreach (RoleInfo Role in colArrayList) { ListItem roleListItem = new ListItem(); roleListItem.Text = Role.RoleName; roleListItem.Value = Role.RoleID.ToString(); colRoles.Add(roleListItem); } ListItem selectRoleListItem = new ListItem(); selectRoleListItem.Text = Localization.GetString("SelectRole.Text", this.LocalResourceFile); selectRoleListItem.Value = "-1"; colRoles.Insert(0, selectRoleListItem); return(colRoles); }
private void ShowPaymentProviders() { // Payment Providers List <PaymentProviderInfo> lst = Controller.GetPaymentProviders(CurrentLanguage); if (lst.Count == 0) { lst = Controller.GetPaymentProviders(DefaultLanguage); } if (lst.Count > 0) { // Lets populate thbe Usergroups into Collection RoleController RoleController = new RoleController(); ArrayList colArrayList = RoleController.GetPortalRoles(PortalId); // Create a ListItemCollection to hold the Roles ListItemCollection colRoles = new ListItemCollection(); // Add all defined Roles to the List foreach (RoleInfo Role in colArrayList) { ListItem RoleListItem = new ListItem(); RoleListItem.Text = Role.RoleName; RoleListItem.Value = Role.RoleID.ToString(); colRoles.Add(RoleListItem); } ListItem SelectRoleListItem = new ListItem(); SelectRoleListItem.Text = Localization.GetString("SelectRole.Text", this.LocalResourceFile); SelectRoleListItem.Value = "-1"; colRoles.Insert(0, SelectRoleListItem); // And now we need the Payment Provider for this subscriber (Portal) List <SubscriberPaymentProviderInfo> lstSub = Controller.GetSubscriberPaymentProviders(PortalId, 0); Table myTable = new Table(); myTable.Attributes.Add("class", "dnnGrid"); myTable.ID = "tblPaymentProvider"; // First the header row TableHeaderRow tr = new TableHeaderRow(); TableHeaderCell th = new TableHeaderCell(); th.Attributes.Add("class", "dnnGridHeader"); LabelControl dnnLbl = LoadControl("~/controls/LabelControl.ascx") as LabelControl; dnnLbl.HelpText = Localization.GetString("ppEnabled.Help", this.LocalResourceFile); dnnLbl.Text = Localization.GetString("ppEnabled.Header", this.LocalResourceFile); th.Controls.Add(dnnLbl); tr.Controls.Add(th); th = new TableHeaderCell(); th.Attributes.Add("class", "dnnGridHeader"); dnnLbl = LoadControl("~/controls/LabelControl.ascx") as LabelControl; dnnLbl.Text = Localization.GetString("Vieworder.Header", this.LocalResourceFile); dnnLbl.HelpText = Localization.GetString("Vieworder.Help", this.LocalResourceFile); th.Controls.Add(dnnLbl); tr.Controls.Add(th); th = new TableHeaderCell(); th.Attributes.Add("class", "dnnGridHeader"); dnnLbl = LoadControl("~/controls/LabelControl.ascx") as LabelControl; dnnLbl.Text = Localization.GetString("Paymentprovider.Header", this.LocalResourceFile); dnnLbl.HelpText = Localization.GetString("Paymentprovider.Help", this.LocalResourceFile); th.Controls.Add(dnnLbl); tr.Controls.Add(th); th = new TableHeaderCell(); th.Attributes.Add("class", "dnnGridHeader"); dnnLbl = LoadControl("~/controls/LabelControl.ascx") as LabelControl; dnnLbl.Text = Localization.GetString("Price.Header", this.LocalResourceFile); dnnLbl.HelpText = Localization.GetString("Price.Help", this.LocalResourceFile); th.Controls.Add(dnnLbl); tr.Controls.Add(th); th = new TableHeaderCell(); th.Attributes.Add("class", "dnnGridHeader"); dnnLbl = LoadControl("~/controls/LabelControl.ascx") as LabelControl; dnnLbl.Text = Localization.GetString("Tax.Header", this.LocalResourceFile); dnnLbl.HelpText = Localization.GetString("Tax.Help", this.LocalResourceFile); th.Controls.Add(dnnLbl); tr.Controls.Add(th); th = new TableHeaderCell(); th.Attributes.Add("class", "dnnGridHeader"); dnnLbl = LoadControl("~/controls/LabelControl.ascx") as LabelControl; dnnLbl.Text = Localization.GetString("Userrole.Header", this.LocalResourceFile); dnnLbl.HelpText = Localization.GetString("Userrole.Help", this.LocalResourceFile); th.Controls.Add(dnnLbl); tr.Controls.Add(th); myTable.Controls.Add(tr); // and next the Provider Rows TableRow myRow; TableCell tblCell; int i = 0; foreach (PaymentProviderInfo pp in lst) { // Skip if no Control defined if (pp.ProviderControl.Trim() == String.Empty) { continue; } i++; //Is this Provider in the List for the Subscriber (Portal) ? SubscriberPaymentProviderInfo Sub = lstSub.Find(sub => sub.PaymentProviderId == pp.PaymentProviderId); bool isChecked = (Sub != null && Sub.IsEnabled); string itemStyle = (i % 2 == 1 ? "dnnGridItem" : "dnnGridAltItem"); myRow = new TableRow(); // The Checkbox cell (first Column) tblCell = new TableCell(); tblCell.Attributes.Add("class", itemStyle); CheckBox chk = new CheckBox(); chk.ID = "chkEnabled" + pp.PaymentProviderId.ToString(); chk.EnableViewState = true; chk.Checked = isChecked; tblCell.Controls.Add(chk); myRow.Controls.Add(tblCell); // The Vieworder cell tblCell = new TableCell(); tblCell.Attributes.Add("class", itemStyle); TextBox txt = new TextBox(); txt.ID = "txtViewOrder" + pp.PaymentProviderId.ToString(); txt.EnableViewState = true; txt.Columns = 2; if (Sub != null) { txt.Text = Sub.ViewOrder.ToString(); } else { txt.Text = "0"; } tblCell.Controls.Add(txt); myRow.Controls.Add(tblCell); // The PaymentProvider-Cell tblCell = new TableCell(); tblCell.Attributes.Add("class", itemStyle); PaymentProviderBase ctrl = this.LoadControl(@"~\DesktopModules\BBStore\Providers\Payment\" + pp.ProviderControl.Trim() + ".ascx") as PaymentProviderBase; ctrl.DisplayMode = ViewMode.Edit; ctrl.Title = pp.ProviderName; ctrl.EnableViewState = true; if (Sub != null) { ctrl.Properties = Sub.PaymentProviderProperties; ctrl.Cost = Sub.Cost; } ctrl.ID = "pp" + pp.PaymentProviderId.ToString(); tblCell.Controls.Add(ctrl); myRow.Controls.Add(tblCell); // We need to create the taxpercent control first (needed by TaxControl) TextBox txtTaxPercent = new TextBox(); txtTaxPercent.ID = "txtTaxPercent" + pp.PaymentProviderId.ToString(); txtTaxPercent.EnableViewState = true; txtTaxPercent.Columns = 6; if (Sub != null) { txtTaxPercent.Text = String.Format("{0:f1}", Sub.TaxPercent); } else { txtTaxPercent.Text = String.Format("{0:f1}", 0.00m); } // The Price cell tblCell = new TableCell(); tblCell.Attributes.Add("class", itemStyle); Label lbl = new Label(); lbl.Text = LocalizeString("lblCost.Text") + ": "; tblCell.Controls.Add(lbl); TaxControl txtPrice = LoadControl("Controls/TaxControl.ascx") as TaxControl; txtPrice.ID = "txtPrice" + pp.PaymentProviderId.ToString(); txtPrice.EnableViewState = true; txtPrice.Orientation = "verticalhorizontal"; txtPrice.Mode = "gross"; txtPrice.PercentControl = txtTaxPercent; if (Sub != null) { txtPrice.Value = Sub.Cost; } else { txtPrice.Value = 0.00m; } tblCell.Controls.Add(txtPrice); tblCell.Controls.Add(new HtmlGenericControl("hr")); lbl = new Label(); lbl.Text = LocalizeString("lblCostPercent.Text") + ": "; tblCell.Controls.Add(lbl); TextBox txtCostPercent = new TextBox(); txtCostPercent.ID = "txtCostPercent" + pp.PaymentProviderId.ToString(); txtCostPercent.EnableViewState = true; txtCostPercent.Columns = 6; if (Sub != null) { txtCostPercent.Text = String.Format("{0:f1}", Sub.CostPercent); } else { txtCostPercent.Text = String.Format("{0:f1}", 0.0m); } tblCell.Controls.Add(txtCostPercent); myRow.Controls.Add(tblCell); // The Tax cell tblCell = new TableCell(); tblCell.Attributes.Add("class", itemStyle); tblCell.Controls.Add(txtTaxPercent); myRow.Controls.Add(tblCell); // The RoleDropdown Column tblCell = new TableCell(); tblCell.Attributes.Add("class", itemStyle); DropDownList ddl = new DropDownList(); ddl.ID = "ddlUserRole" + pp.PaymentProviderId.ToString(); ddl.EnableViewState = true; ddl.DataSource = colRoles; ddl.DataBind(); if (Sub != null) { ddl.SelectedValue = Sub.Role.ToString(); } tblCell.Controls.Add(ddl); myRow.Controls.Add(tblCell); myTable.Controls.Add(myRow); } phPayment.Controls.Add(myTable); } else { string message = Localization.GetString("NoPaymentprovider.Message", this.LocalResourceFile); DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, message, ModuleMessage.ModuleMessageType.YellowWarning); } }
private ListItemCollection GetUnitClassList() { UnitClassList list = UnitClassList.GetUnitClassList(); // prepare a collection containing an empty value signifying that no unit class is selected ListItemCollection collection = new ListItemCollection(); foreach (UnitClass item in list) collection.Add( new ListItem( item.Name, item.ID.ToString() ) ); collection.Insert( 0, new ListItem( "DOES NOT APPLY", "0" ) ); return collection; }
private ListItemCollection GetFactionList() { FactionList list = FactionList.GetFactionList(); // prepare a collection containing an empty value signifying that no unit class is selected ListItemCollection collection = new ListItemCollection(); foreach (Faction item in list) collection.Add( new ListItem( item.Name, item.ID.ToString() ) ); collection.Insert( 0, new ListItem( "UNSELECTED", "0" ) ); return collection; }
//======================================================== //Population methods //======================================================== #region Population methods //-------------------------------------------------------- /// <summary>Creates a Select one... item at the top of a list</summary> public static void CreateSelectOneItem(ListItemCollection list) { list.Insert(0, new ListItem("Select one...", "")); }
protected void Page_Load(object sender, System.EventArgs e) { try { Controller = new BBStoreController(); taxUnitCost.PercentControl = txtTaxPercent; taxOriginalUnitCost.PercentControl = txtTaxPercent; taxPriceUnitCost.PercentControl = txtPriceTaxPercent; taxPriceOriginalUnitCost.PercentControl = txtPriceTaxPercent; LocaleController lc = new LocaleController(); Dictionary <string, Locale> loc = lc.GetLocales(PortalId); //TODO: Panels ausblenden wenn kein Modul verwendet ModuleController objModules = new ModuleController(); if (objModules.GetModuleByDefinition(PortalId, "BBStore Product Groups") == null) { HasProductGroupModule = false; } if (objModules.GetModuleByDefinition(PortalId, "BBStore Product Features") == null) { HasProductFeatureModule = false; } Hashtable storeSettings = Controller.GetStoreSettings(PortalId); if (storeSettings != null) { _imageDir = (string)(storeSettings["ProductImageDir"] ?? ""); } // If this is the first visit to the page if (Page.IsPostBack == false) { // Show Supplier ? if (storeSettings != null && storeSettings["SupplierRole"] != null && (string)storeSettings["SupplierRole"] != "-1") { pnlSupplier.Visible = true; RoleController roleController = new RoleController(); //RoleInfo role = roleController.GetRole(Convert.ToInt32(storeSettings["SupplierRole"]), PortalId); ArrayList aUsers = roleController.GetUsersByRoleName(PortalId, (string)storeSettings["SupplierRole"]); ListItemCollection users = new ListItemCollection(); foreach (UserInfo user in aUsers) { users.Add(new ListItem(user.DisplayName, user.UserID.ToString())); } string selText = Localization.GetString("SelectSupplier.Text", this.LocalResourceFile); users.Insert(0, new ListItem(selText, "-1")); cboSupplier.DataSource = users; cboSupplier.DataValueField = "Value"; cboSupplier.DataTextField = "Text"; cboSupplier.DataBind(); } // Shipping Models List <ShippingModelInfo> shippingModels = Controller.GetShippingModels(PortalId); cboShippingModel.DataSource = shippingModels; cboShippingModel.DataValueField = "ShippingModelId"; cboShippingModel.DataTextField = "Name"; cboShippingModel.DataBind(); string selUnitText = Localization.GetString("SelectUnit.Text", this.LocalResourceFile); ddlUnit.Items.Add(new ListItem(selUnitText, "-1")); foreach (UnitInfo unit in Controller.GetUnits(PortalId, CurrentLanguage, "Unit")) { ddlUnit.Items.Add(new ListItem(unit.Unit, unit.UnitId.ToString())); } ddlUnit.DataValueField = "Value"; ddlUnit.DataTextField = "Text"; ddlUnit.DataBind(); // Set ProductGroups Visible / not Visible //pnlProductGroup.Visible = HasProductGroupModule; SimpleProductInfo SimpleProduct = null; if (Request["productid"] != null) { ProductId = Convert.ToInt32(Request["productid"]); } // if product exists if (ProductId > 0) { SimpleProduct = Controller.GetSimpleProductByProductId(PortalId, ProductId); } List <ILanguageEditorInfo> dbLangs = new List <ILanguageEditorInfo>(); if (SimpleProduct == null) { taxUnitCost.Value = 0.00m; taxUnitCost.Mode = "gross"; txtTaxPercent.Text = 0.0m.ToString(); taxOriginalUnitCost.Value = 0.00m; taxOriginalUnitCost.Mode = "gross"; ImageSelector.Url = _imageDir + "This_fileName-Should_not_3xist"; cboSupplier.SelectedValue = "-1"; dbLangs.Add(new SimpleProductLangInfo() { Language = CurrentLanguage }); lngSimpleProducts.Langs = dbLangs; txtWeight.Text = 0.000m.ToString(); } else { // Fill in the Language information foreach (SimpleProductLangInfo simpleProductLang in Controller.GetSimpleProductLangs(SimpleProduct.SimpleProductId)) { dbLangs.Add(simpleProductLang); } lngSimpleProducts.Langs = dbLangs; // Set Image Info int fileId = -1; if (!String.IsNullOrEmpty(SimpleProduct.Image)) { try { IFileInfo file = FileManager.Instance.GetFile(PortalId, SimpleProduct.Image); if (file != null) { fileId = file.FileId; } } catch (Exception) { fileId = -1; } } string imageUrl = ""; if (fileId > -1) { imageUrl = "FileID=" + fileId.ToString(); } else { imageUrl = _imageDir + "This_fileName-Should_not_3xist"; } // Set other fields txtItemNo.Text = SimpleProduct.ItemNo; txtTaxPercent.Text = SimpleProduct.TaxPercent.ToString(); taxUnitCost.Mode = "gross"; taxUnitCost.Value = SimpleProduct.UnitCost; taxOriginalUnitCost.Mode = "gross"; taxOriginalUnitCost.Value = SimpleProduct.OriginalUnitCost; chkDisabled.Checked = SimpleProduct.Disabled; chkHideCost.Checked = SimpleProduct.HideCost; chkNoCart.Checked = SimpleProduct.NoCart; cboSupplier.SelectedValue = SimpleProduct.SupplierId.ToString(); ddlUnit.SelectedValue = SimpleProduct.UnitId.ToString(); ImageSelector.Url = imageUrl; imgImage.ImageUrl = BBStoreHelper.FileNameToImgSrc(imageUrl, PortalSettings); txtWeight.Text = SimpleProduct.Weight.ToString(); // Set ShippingModel List <ProductShippingModelInfo> productshippingModels = Controller.GetProductShippingModelsByProduct(SimpleProduct.SimpleProductId); if (productshippingModels.Count > 0) { cboShippingModel.SelectedValue = productshippingModels[0].ShippingModelId.ToString(); } } // Treeview Basenode TreeNode newNode = new TreeNode(Localization.GetString("treeProductGroups.Text", this.LocalResourceFile), "_-1"); newNode.SelectAction = TreeNodeSelectAction.Expand; newNode.PopulateOnDemand = true; newNode.ImageUrl = @"~\images\category.gif"; newNode.ShowCheckBox = false; treeProductGroup.Nodes.Add(newNode); //newNode.Expanded = false; // Product Price Localization.LocalizeGridView(ref grdPriceList, LocalResourceFile); grdPriceList.DataSource = ProductPrices; grdPriceList.DataBind(); RoleController roleController1 = new RoleController(); //RoleInfo role = roleController.GetRole(Convert.ToInt32(storeSettings["SupplierRole"]), PortalId); ArrayList aRoles = roleController1.GetPortalRoles(PortalId); ListItemCollection roles = new ListItemCollection(); foreach (RoleInfo role in aRoles) { roles.Add(new ListItem(role.RoleName, role.RoleID.ToString())); } string selText1 = Localization.GetString("SelectRole.Text", this.LocalResourceFile); roles.Insert(0, new ListItem(selText1, "-1")); ddlPriceRoleId.DataSource = roles; ddlPriceRoleId.DataValueField = "Value"; ddlPriceRoleId.DataTextField = "Text"; ddlPriceRoleId.DataBind(); } if (HasProductFeatureModule) { FeatureGrid.ProductId = ProductId; } } catch (Exception exc) { //Module failed to load Exceptions.ProcessModuleLoadException(this, exc); } }
public void Insert(int index, ListItem item) { base.Insert(index, item); _lst.Insert(index, item); }
private ListItemCollection GetParentList() { CodexRecordList list; object businessObject = Session["CurrentObject"]; if ( businessObject == null || !( businessObject is CodexRecordList ) ) { businessObject = CodexRecordList.GetCodexRecordList(); Session["CurrentObject"] = businessObject; } list = (CodexRecordList)businessObject; // prepare a collection containing an empty value signifying that no unit class is selected ListItemCollection collection = new ListItemCollection(); foreach ( CodexRecord item in list ) collection.Add( new ListItem( item.Title, item.ID.ToString() ) ); collection.Insert( 0, new ListItem( "***ROOT***", "0" ) ); return collection; }
protected void ddPerson_SelectedIndexChanged(object sender, EventArgs e) { ComposeDAL sdal = new ComposeDAL(); if (ddPerson.SelectedValue == "-1") { ddReciever.Items.Clear(); } else if (ddPerson.SelectedValue == "-2") { ListItemCollection lic = new ListItemCollection(); int id = Convert.ToInt32(Session["Feedback_Key"]); int count = sdal.getMultiple(id); if (count > 1) { int j = 0; int k = -1; for (int i = 1; i < 1000; i++) { DataSet ds = sdal.Check(id, i); DataTable dt = ds.Tables[0]; try { DataRow dr = dt.Rows[0]; if (ds.Tables[0].Rows.Count > 0) { int course_id = Convert.ToInt32(dr["course_id"]); DataSet ds2 = sdal.GetInstructorName(course_id); DataTable dt2 = ds2.Tables[0]; DataRow dr2 = dt2.Rows[0]; string name = dr2["Instructor Name"].ToString(); string temp = k.ToString(); lic.Insert(j, new ListItem(name, temp)); j++; k--; } } catch (Exception ex) { continue; } } ddReciever.DataSource = lic; ddReciever.DataTextField = "Text"; ddReciever.DataValueField = "Text"; ddReciever.DataBind(); } else { ddReciever.DataSource = sdal.GetInstructorName(); ddReciever.DataTextField = "Instructor Name"; ddReciever.DataValueField = "Instructor Name"; ddReciever.DataBind(); } } else if (ddPerson.SelectedValue == "-3") { ddReciever.DataSource = sdal.GetStudentName(); ddReciever.DataTextField = "Student Name"; ddReciever.DataValueField = "Student Name"; ddReciever.DataBind(); } else { //label error here } }
protected void MoveSelectedUp(ListItemCollection items) { var selItems = new List<ListItem>(); for (int i = items.Count - 1; i >= 0; i--) { if (items[i].Selected) { selItems.Add(items[i]); items.RemoveAt(i); } } foreach (var i in selItems) items.Insert(0, i); }