public override void DataBind() { if (this._bound) { return; } _bound = true; object obj = DataBinder.Eval(this.NamingContainer, "DataItem.ItemId"); if (obj != null && obj.ToString() != "") { _itemId = (int)obj; } object title = DataBinder.Eval(this.NamingContainer, "DataItem.Title"); object _prop = null; if (!StringUtils.IsNullOrWhiteSpace(Property)) { _prop = DataBinder.Eval(this.NamingContainer, "DataItem." + Property); } switch (Type) { case LinkType.Image: object image; if (ThumbImage) { image = DataBinder.Eval(this.NamingContainer, "DataItem.ThumbImage"); } else { image = DataBinder.Eval(this.NamingContainer, "DataItem.Image" + imageNumber.ToString()); } ItemImage img = new ItemImage(image, title, width, height); img.Type = ImageType; img.FillColor = FillColor; this.Controls.Add(img); break; case LinkType.Title: if (StringUtils.IsNullOrWhiteSpace(Property)) { this.InnerHtml = title.ToString(); } else { this.InnerHtml = _prop.ToString(); } break; default: this.InnerHtml = _innerText; break; } Config cfg = new Config(); this.HRef = string.Format("{2}/{1}/{0}", DataBinder.Eval(this.NamingContainer, "DataItem.UniqueName"), path, WebContext.Root ); base.DataBind(); }
public override void DataBind() { if (this._bound) { return; } _bound = true; object obj = DataBinder.Eval(this.NamingContainer, "DataItem.ItemId"); if (obj != null && obj.ToString() != "") { _itemId = (int)obj; } ItemsMgr pMgr = new ItemsMgr(); DataTable dt = null; string _key = "ItemParents" + _itemId.ToString(); if (thisPage.PageContext[_key] != null) { dt = (DataTable)thisPage.PageContext[_key]; } else { DataTable cats = pMgr.GetItemParents(_itemId); dt = pMgr.GetItems((int)cats.Rows[0]["CategoryId"]); thisPage.PageContext["ItemPrices"] = dt; } DataView dv = new DataView(dt, "", "ItemId ASC", DataViewRowState.CurrentRows); bool isNext = false; DataRow Item = null; foreach (DataRowView drv in dv) { if (isNext) { _itemId = (int)drv["ItemId"]; Item = pMgr.GetItem(_itemId); break; } if ((int)drv["ItemId"] == _itemId) { isNext = true; } } if (Item == null) { this.Visible = false; return; } object title = Item["Title"]; object _prop = null; if (!StringUtils.IsNullOrWhiteSpace(Property)) { _prop = Item[Property]; } switch (Type) { case LinkType.Image: object image; if (ThumbImage) { image = Item["ThumbImage"]; } else { image = Item["Image" + imageNumber.ToString()]; } ItemImage img = new ItemImage(image, title, width, height); img.Type = ImageType; img.FillColor = FillColor; this.Controls.Add(img); break; case LinkType.Title: if (StringUtils.IsNullOrWhiteSpace(Property)) { this.InnerHtml = title.ToString(); } else { this.InnerHtml = _prop.ToString(); } break; default: this.InnerHtml = _innerText; break; } Config cfg = new Config(); this.HRef = string.Format("{2}/{1}/{0}", Item["UniqueName"], path, WebContext.Root ); base.DataBind(); }