Imports
BVSoftware.Bvc5.Core
Partial
Class
BVModules_Controls_ProductMainImage
Inherits
System.Web.UI.UserControl
Protected
Sub
Page_PreRender(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.PreRender
If
TypeOf
Me
.Page
Is
BaseStoreProductPage
Then
Dim
product
As
Catalog.Product =
DirectCast
(
Me
.Page, BaseStoreProductPage).LocalProduct
If
product IsNot
Nothing
Then
If
Not
String
.IsNullOrEmpty(product.ParentId)
Then
product = Catalog.InternalProduct.FindByBvin(product.ParentId)
End
If
If
product.AdditionalImages.Count = 0
Then
Me
.imgMain.ImageUrl =
Me
.Page.ResolveUrl(Utilities.ImageHelper.GetValidImage(product.ImageFileMedium,
True
))
Me
.imgMain.AlternateText = HttpUtility.HtmlEncode(product.ImageFileMediumAlternateText)
ViewUtilities.ForceImageSize(imgMain, imgMain.ImageUrl, ViewUtilities.Sizes.Medium,
Me
.Page)
Else
Me
.imgMain.ImageUrl =
Me
.Page.ResolveUrl(Utilities.ImageHelper.GetValidImage(product.AdditionalImages(0).FileName,
True
))
Me
.imgMain.AlternateText = HttpUtility.HtmlEncode(product.AdditionalImages(0).AlternateText)
If
product.AdditionalImages.Count > 1
Then
Me
.AdditionalImagesLink.Visible =
True
Me
.AdditionalImagesLink.Style.Add(
"cursor"
,
"pointer"
)
Me
.AdditionalImagesLink.Attributes.Add(
"onclick"
, ViewUtilities.GetAdditionalImagesPopupJavascript(product.Bvin,
Me
.Page))
End
If
End
If
End
If
End
If
End
Sub
End
Class