Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    77
    Thanks
    8
    Thanked 0 Times in 0 Posts

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

    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 :-

    Code:
    <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 :-

    Code:
        #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;
            }
        }
    Last edited by vinyl-junkie; 04-20-2007 at 01:50 PM. Reason: Added code tags

  • #2
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •