void BindData() { if (brandID != 0) { btnPost.Text = "更新"; } ProductBrand brand = ProductBrands.GetProductBrand(brandID); if (brand == null) { brand = new ProductBrand(); } this.txtBrandAbstract.Text = brand.BrandAbstract; this.txtBrandContent.Text = brand.BrandContent; if (!string.IsNullOrEmpty(brand.BrandGroup)) { ddlBrandGroup.SelectedItem.Selected = false; ddlBrandGroup.Items.FindByText(brand.BrandGroup).Selected = true; } this.txtBrandName.Text = brand.BrandName; this.txtBrandTitle.Text = brand.BrandTitle; this.txtDisplayOrder.Text = brand.DisplayOrder.ToString(); csBrand.SelectedValue = brand.BrandStatus; if (brand.File != null) { this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(brand.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } else { this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } }
private string GetEmbedCode(string path, string filename) { SiteFile file = SiteFiles.GetFile(path, filename); if (file != null) { if (!GlobalSettings.IsImage(filename)) { return(string.Format("<a href=\"{0}\">{1}</a>", FileStorageProvider.GetGenericDownloadUrl(file.File), filename)); } else { int width = 200; int height = 200; try { width = int.Parse(this.txtWidth.Text); } catch { } try { height = int.Parse(this.txtHeight.Text); } catch { } return(GlobalSettings.ResizeImageHtml(SiteUrlManager.GetResizedImageUrl(file.File, width, height), width, height, false)); } } else { return(string.Empty); } }
/// <summary> /// 获取默认图像 /// </summary> /// <param name="width"></param> /// <param name="height"></param> /// <returns></returns> public string GetDefaultImageUrl(int width, int height) { if (width == 0 || height == 0) { if (File != null) { return(FileStorageProvider.GetGenericDownloadUrl(File)); } else { return(SiteUrlManager.GetNoPictureUrl()); } } else { if (File == null) { return(SiteUrlManager.GetNoPictureUrl(width, height)); } else { return(SiteUrlManager.GetResizedImageUrl(File, width, height)); } } }
protected void egvIndustries_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ProductIndustry industry = e.Row.DataItem as ProductIndustry; Image industryLogo = e.Row.FindControl("IndustryLogo") as Image; if (industryLogo != null) { if (industry.File != null) { industryLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(industry.File, (int)industryLogo.Width.Value, (int)industryLogo.Height.Value); } else { industryLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)industryLogo.Width.Value, (int)industryLogo.Height.Value); } } HyperLink hyName = e.Row.FindControl("hlIndustryName") as HyperLink; if (hyName != null) { hyName.Text = industry.IndustryName; hyName.NavigateUrl = GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx?product-product&ii=" + industry.IndustryID; } } }
void BindData() { ShowPicture showPicture = null; if (action == OperateType.Edit) { showPicture = ShowPictures.Get(showPictureID); } else { showPicture = new ShowPicture(); } this.txtDescription.Text = showPicture.Description; this.txtLink.Text = showPicture.Link; this.txtTitle.Text = showPicture.Title; this.txtDisplayOrder.Text = showPicture.DisplayOrder.ToString(); if (showPicture.File != null) { this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(showPicture.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } else { this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } }
protected void egvBrands_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ProductBrand brand = e.Row.DataItem as ProductBrand; Image brandLogo = e.Row.FindControl("BrandLogo") as Image; if (brandLogo != null) { if (brand.File != null) { brandLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(brand.File, (int)brandLogo.Width.Value, (int)brandLogo.Height.Value); } else { brandLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)brandLogo.Width.Value, (int)brandLogo.Height.Value); } } HyperLink hyName = e.Row.FindControl("hlBrandName") as HyperLink; if (hyName != null) { hyName.Text = brand.BrandName; hyName.NavigateUrl = GlobalSettings.RelativeWebRoot + "controlpanel/controlpanel.aspx?product-product&bi=" + brand.BrandID; } } }
protected void Button33_Click(object sender, EventArgs e) { ProductBrand brand = ProductBrands.GetProductBrand(10); Image1.ImageUrl = SiteUrlManager.GetResizedImageUrl(brand.File, 80, 80); HyperLink2.NavigateUrl = brand.Url; HyperLink2.Text = brand.BrandLogo; }
protected void egvShowPictures_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ShowPicture picture = e.Row.DataItem as ShowPicture; Image showPictureThumb = e.Row.FindControl("ShowPictureThumb") as Image; if (showPictureThumb != null) { if (picture.File != null) { showPictureThumb.ImageUrl = SiteUrlManager.GetResizedImageUrl(picture.File, (int)showPictureThumb.Width.Value, (int)showPictureThumb.Height.Value); } else { showPictureThumb.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)showPictureThumb.Width.Value, (int)showPictureThumb.Height.Value); } } } }
void BindData() { ProductIndustry industry = null; if (action == OperateType.Add) { industry = new ProductIndustry(); industry.ParentID = parentID; } else { industry = ProductIndustries.GetProductIndustry(industryID); btnPost.Text = "更新"; } if (industry.ParentID == 0) { parentRow.Visible = false; } else { parentRow.Visible = true; lblParentName.Text = ProductIndustries.GetProductIndustry(industry.ParentID).IndustryName; } this.txtIndustryAbstract.Text = industry.IndustryAbstract; this.txtIndustryContent.Text = industry.IndustryContent; this.txtIndustryName.Text = industry.IndustryName; this.txtIndustryTitle.Text = industry.IndustryTitle; this.txtDisplayOrder.Text = industry.DisplayOrder.ToString(); this.csIndustry.SelectedValue = industry.IndustryStatus; if (industry.File != null) { this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(industry.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } else { this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } }