protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e) { string city = DropDownList1.SelectedValue; if (city != string.Empty) { Properties.XPath = "Properties/Property[@city='" + city + "']"; } else { Properties.XPath = "Properties/Property"; } XmlDocument xdoc = Properties.GetXmlDocument(); XmlNodeList xnList = xdoc.SelectNodes("Properties/Property"); int sum = 0; foreach (XmlNode xn in xnList) { Debug.WriteLine("BLA: " + xn.InnerXml); if (String.Equals(xn.Attributes["city"].Value.ToString(), city, StringComparison.Ordinal)) { sum += Int32.Parse(xn.Attributes["value"].Value); } } Label1.Text = sum.ToString(); Label1.DataBind(); Properties.DataBind(); GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (CartList.Count == 0) { btnCart.Text = "View Cart"; } else { btnCart.Text = string.Format("View Cart ({0})", CartList.Count); } if (System.Web.HttpContext.Current != null) { userName = HttpContext.Current.User.Identity.Name; isAdmin = Roles.IsUserInRole("admin"); } if (userName == "") { btnWelcome.Text = "Welcome, Guest"; } else { btnWelcome.Text = string.Format("Welcome, {0}", userName); } if (isAdmin) { btnManageBook.Visible = true; btnManageOrder.Visible = true; btnManageDiscount.Visible = true; } else { btnManageBook.Visible = false; btnManageOrder.Visible = false; btnManageDiscount.Visible = false; } Color[] colourarray = new Color[] { Color.Cyan, Color.LightGoldenrodYellow, Color.WhiteSmoke, Color.Chartreuse, Color.Ivory }; Color[] colourarray2 = new Color[] { Color.Black, Color.CornflowerBlue, Color.LightSlateGray, Color.MidnightBlue, Color.CadetBlue }; Random r = new Random(); if (BusinessLogic.GetCurrentDiscount() == 0) { Label1.Visible = false; } else { Label1.Text = "Storewide Discount " + String.Format("{0:##}", BusinessLogic.GetCurrentDiscount() * 100) + "% " + " until " + (BusinessLogic.GetCurrentDiscountEndDate()).Date.ToString("d"); Label1.ForeColor = colourarray[r.Next(0, colourarray.Length)]; Label1.DataBind(); Label1.BackColor = colourarray2[r.Next(0, colourarray2.Length)]; } }
public void loadLabel() { lbllookuptable.DataBind(); lbl_SectionType.DataBind(); lbl_ComponentType.DataBind(); lbl_SchoolType.DataBind(); lbl_LocationType.DataBind(); lblvalue.DataBind(); Label2.DataBind(); Label1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString.Get("Id"))) { _id = Convert.ToInt32(Request.QueryString.Get("Id")); } if (!Page.IsPostBack && _id > -1) { Label1.Text = myEntities.ViewForums.Where(v => v.Id == _id).Select(v => v.Title).Single(); Label1.DataBind(); } }
private void BindData(DataTable abc = null) { if (abc != null) { GridView1.DataSource = abc; } else { GridView1.DataSource = AutorivetDB.otherpw(pkg); } Label1.Text = pkg + "工艺文件"; Label1.DataBind(); GridView1.DataBind(); }