...

View Full Version : code behind .net inline tag style="border-width:0px;"



prajwala
04-20-2007, 05:50 AM
There is one image in .ascx page. I am trying to give the border to that image as 1px.but it is taking 0px border from .net .How to solve this problem?

The following code in .ascx file :-



<asp:Panel ID="panImage" runat="server" Visible="false">
<div class="thumb">
<asp:HyperLink ID="hypImage" runat="server">
<asp:Image ID="imgProductThumb" CssClass="" runat="server" />
</asp:HyperLink>
</div>
</asp:Panel>


and in .net file :-



#region Public Methods
public void SetData(ProductInfo productListItem)
{
SetDisplayType();
_ProductGuid = productListItem.ProductGuid.ToString();
//Set the New Data
ltAboveImage.Text = productListItem.ProductTitle;
ltTitle.Text = productListItem.ProductTitle;
ltDescription.Text = productListItem.ProductDescription;
ltAboveImage.Text = productListItem.ProductTitle;

if (productListItem.AssociatedUser != null && !string.IsNullOrEmpty(productListItem.AssociatedUser.DisplayName))
{
lblArtistName.Text = productListItem.AssociatedUser.DisplayName;
}
else
{
phArtistName.Visible = false;
}

hypTitle.Text = productListItem.ProductTitle;
hypTitle.NavigateUrl = PathIndex;//"~/Commerce/ProductDetail.aspx?ProductGuid=" + productListItem.ProductGuid.ToString();
hypBuyIt.NavigateUrl = PathIndex;//"~/Commerce/ProductDetail.aspx?ProductGuid=" + productListItem.ProductGuid.ToString();

lblReleaseDate.Text = productListItem.ReleaseDate.ToShortDateString();
phReleaseDate.Visible = ShowReleaseDate;

// handle product thumb
string imagePath = Helper.GetImagePath(productListItem.ProductImages,
"Thumbnail",
APIType.EcommerceAPI);
if (string.IsNullOrEmpty(imagePath))
{
imgProductThumb.Visible = false;
}
else
{
imgProductThumb.ImageUrl = imagePath;
hypImage.NavigateUrl = "~/Commerce/ProductDetails.aspx?ProductGuid=" + productListItem.ProductGuid.ToString();
}

// handle sale price
if (productListItem.IsOnSale == 1)
{
phSalePrice.Visible = true;
phPrice.Visible = false;
lblSaleOriginalPrice.Text = productListItem.BasePrice.ToString("C");
lblSalePrice.Text = productListItem.SalePrice.ToString("C");

// 2 = % | 1 = flat rate
string saleDiscountMessage;
if (productListItem.SaleType == 2)
{
decimal adjustmentPercentage = Math.Floor(productListItem.SaleAdjustment);
saleDiscountMessage = "Save " + adjustmentPercentage.ToString() + "%!";
}
else
{
saleDiscountMessage = "Save " + productListItem.SaleAdjustment.ToString("C") + "!";
}
lblSaleDiscount.Text = saleDiscountMessage;
lblSaleDiscount.Visible = ShowDiscount;
}
else
{
lblPrice.Text = productListItem.BasePrice.ToString("C");
phSalePrice.Visible = false;
phPrice.Visible = true;
}
}

scoper
04-29-2007, 02:12 PM
You can set the style attribute or borderwidth attribute in the ascx file even though style doesn't appear in the intellisense it is still picked up when the control is parsed.

Alternatively if you want to set it from the .cs file then you can do this:

imgProductThumb.BorderWidth = 1;
or
imgProductThumb.attributes["style"] = "border-width:1px;";

Hope it helps

Scott



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum