This is a migrated thread and some comments may be shown as answers.

Couple Things

9 Answers 183 Views
ImageGallery
This is a migrated thread and some comments may be shown as answers.
SDI
Top achievements
Rank 1
SDI asked on 13 Mar 2015, 02:19 PM
I am trying to set the background color on the thumbnail area. Its BLACK, i tried css but it didn't work.

.RadImageGallery .rigThumbnailsList {
    background-color: white;
}

I also get an error once lightbox is loaded from the thumbnail click event.

Say i have 6 images in the thumbnail and i click any thumbnail to open LightBox. It pops up with the correct image and showing say "Image 4 of 6" then i click one of the buttons to navigate and i get an ".../store/fake" - file does not exist. We dont have a fake directory, all files are loaded with advanced databinding. So confused why its looking for a file.

Also when i click again in the gallery after closing the lightbox, it seems its still loaded in memory. The image 4 is still showing from last click then it suddenly switches to say "2" which i just clicked to reopen the light box. Do i have to destroy lightbox after its closed?

9 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 18 Mar 2015, 07:32 AM
Hello,

Regarding the thumbnails area background color, you should be able to change it by modifying the CSS as demonstrated below.

CSS:
.RadImageGallery ul.rigThumbnailsList  {
    background-color: white;
}

As for the lightbox issues I have to say that the described behavior is not expected. In order for us to investigate what is causing them I would like to ask you to share with us the markup and code-behind of the page.

Additionally please try-out the following on your end.
  1. Upgrade to the latest version(if you are using an older one) and test the application again.
  2. Verify that a JavaScript error is not thrown that might be breaking the functionality.


Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
SDI
Top achievements
Rank 1
answered on 18 Mar 2015, 12:24 PM
Right its a list, so putting in the "ul" for the css worked. Thanks!

I am adding a RadImageGallery in code-behind to a placeholder.

myRadImageGallery.DisplayAreaMode = ImageGalleryDisplayAreaMode.LightBox
myRadImageGallery.ThumbnailsAreaSettings.ThumbnailsSpacing = New WebControls.Unit(3)
myRadImageGallery.ThumbnailsAreaSettings.Height = New WebControls.Unit(Convert.ToDouble(35))
myRadImageGallery.ThumbnailsAreaSettings.ShowScrollbar = False
myRadImageGallery.ThumbnailsAreaSettings.ShowScrollButtons = False
myRadImageGallery.ThumbnailsAreaSettings.Mode = ImageGalleryThumbnailsAreaMode.Thumbnails
myRadImageGallery.ThumbnailsAreaSettings.EnableZoneScroll = True
 
' set the h/w of each thumbnail
myRadImageGallery.ThumbnailsAreaSettings.ThumbnailHeight = New WebControls.Unit(28)
myRadImageGallery.ThumbnailsAreaSettings.ThumbnailWidth = New WebControls.Unit(28)
 
myRadImageGallery.DataSource = Me.GetGalleryImages(StoreItemId, cMyManager)
myRadImageGallery.DataThumbnailField = "ImageThumbnail"
myRadImageGallery.DataImageField = "Image"
myRadImageGallery.DataBind()
 
myHtmlGenericControl.Controls.Add(myRadImageGallery)
' add to the placeholder
MyPlaceHolder.Controls.Add(myHtmlGenericControl)

It shows correctly and displays the Thumbnail images. Clicking on an thumbnail image brings up the LightBox correctly, but doesnt show AJAX. Its actually empty for a while then the image suddenly appears. If i navigate the light box it correctly show AJAX and goes through the image list, but pops up the describe message box about '\fake\" file doesnt exist. This is in the environment, its not released online yet. If i close the lightbox and reopen by clicking on another thumbnail that was NOT the last one it left off with it opens back up lightbox with the previous selected image showing, then after a few seconds, it switches to the one that was just selected, again no AJAX either until right before it switches. If another product in this RadListView has only 1 thumbnail it shows AJAX correctly when it loads, but the '\fake\' message box appears again.

Now this is a store, so on the page their is a set number of items in a RadListView with the layout in a Template. This works fine they all show as the use has designed the layout to be.

<div id="divItemTemplate" runat="server" style="float: left; margin-right: 15px;">
    <%--main item block - width and height determined by the application--%>
    <asp:Panel runat="server" ID="PanelItem" Height='<%#ItemHeight%>' Width='<%#ItemWidth%>'>
        <fieldset style="float: left; width: 100%; margin-top: 10px; height: 100%; float: left;" class="ui-widget ui-widget-content ui-corner-all">
            <legend id="Legend1" style="text-align: center;" class="ui-widget-header ui-corner-all">  <b><%#Eval("Name")%></b>  </legend>
            <%--main wrapper for the item in the fieldset--%>
            <div style="float: left; width: 100%;">
                <div style="float: left; width: 100%; margin: 5px;">
                    <asp:PlaceHolder runat="server" ID="PlaceHolderTop" />
                </div>
                <div style="float: left; width: 100%;">
                    <div runat="server" id="divLeft" style="float: left;">
                        <asp:PlaceHolder runat="server" ID="PlaceHolderLeft" />
                    </div>
                    <div runat="server" id="divCenter" style="float: left; margin-left: 5px;">
                        <asp:PlaceHolder runat="server" ID="PlaceHolderCenter" />
                    </div>
                    <div runat="server" id="divRight" style="float: left; margin-left: 5px;">
                        <asp:PlaceHolder runat="server" ID="PlaceHolderRight" />
                    </div>
                </div>
                <div style="float: left; width: 100%; margin: 5px;">
                    <asp:PlaceHolder runat="server" ID="PlaceHolderBottom" />
                </div>
            </div>
        </fieldset>
    </asp:Panel>
</div>

Protected ReadOnly Property ItemWidth() As Unit
     Get
         Return DirectCast(ViewState("ItemWidth"), Unit)
     End Get
 End Property
 
 Protected ReadOnly Property ItemHeight() As Unit
     Get
         Return DirectCast(ViewState("ItemHeight"), Unit)
     End Get
 End Property
 
 Protected ReadOnly Property HeightPage() As Unit
     Get
         Return DirectCast(ViewState("HeightPage"), Unit)
     End Get
 End Property

Error message box


Is the RadImageGallery being dynamically loaded a problem? Is there something else i need to setup for the LightBox?


0
SDI
Top achievements
Rank 1
answered on 20 Mar 2015, 04:04 PM
Telerik, you see anything here? You must have something in the control for it to be looking in "...\fake" for some reason. Again we are doing databinding via SQL Server, not a folder. So not even sure why the LightBox from the Gallery is even looking for a folder or file.

thanks!
0
Angel Petrov
Telerik team
answered on 23 Mar 2015, 08:30 AM
Hi,

Indeed the problem may be relate to the dynamic creation of the control. Could you please let us know at what stage of the page life-cycle is the control added? Additionally please try modifying the binding so that the control gets populated inside the NeedDataSource handler(as demonstrated here).

Have in mind that it would be hard to tell what exactly causes this problem without replicating it locally. Considering the aforementioned I would kindly like to ask you to provide us with a small sample which we can debug.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
SDI
Top achievements
Rank 1
answered on 23 Mar 2015, 02:14 PM
I took the page code out and its mark-up and put it into a zip. You can see the AddControl (line 435) function gets called in the in the ItemCreated event. It then creates the control and places it in a PlaceHolder - "Case cMyManager.ProductLayoutItems.Image" (line 565). When its created it does indeed get a DataSource added to the Gallery. I tried adding a handler too it as well and it still showed the "fake" message.

Let me know if there is a setting to make it stop looking for a file.

I thought i could upload a zip but i cant. Ithought u used to be able to. So used the format.

aspx
001.<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
002. 
003.<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
004. 
005.    <style type="text/css">
006.        .DivOuter
007.        {
008.            width: 100%;
009.            text-align: center;
010.        }
011.         
012.        .DivCenter
013.        {
014.            display: inline-block;
015.        }
016.         
017.        .rbText
018.        {
019.            font-size: larger;
020.        }
021.        .detailsTop
022.        {
023.            width: 100%;
024.            height: 150px;           
025.        }
026.        .detailsTop ul
027.        {
028.            list-style-image: none;
029.            list-style-type: none;
030.            margin: 0;
031.            padding: 10px;
032.        }
033.        .detailsTop ul label
034.        {
035.            font-weight: bold;           
036.        }
037.        .detailsBottom
038.        {
039.            width: 100%;       
040.            height: 35%;               
041.        }
042.        .detailsBottom ul
043.        {
044.            list-style-image: none;
045.            list-style-type: none;
046.            margin: 0;
047.            padding: 10px;
048.        }
049.        .detailsBottom ul label
050.        {
051.            font-weight: bold;           
052.        }
053.       .detailsButton
054.        {
055.            width: 100%;       
056.            height: 225px;               
057.        }       
058.        .image-container
059.        {
060.            padding: 10px;
061.            width: 120px;
062.            float: left;
063.            vertical-align:middle;  
064.            text-align:center;        
065.        }
066.        .data-container
067.        {  
068.            width: auto;           
069.        }
070.        .numericPageSize {
071.            vertical-align: middle;
072.            line-height: 22px;
073.            display: inline-block;
074.        }
075. 
076. 
077.    </style>
078. 
079.    <%--RadImageGallery--%>
080.    <style type="text/css">
081.        .RadImageGallery .rigThumbnailsList li img {
082.            opacity: 1;           
083.        }
084. 
085.        .RadImageGallery ul.rigThumbnailsList  {
086.            background-color: white;
087.        }
088.    </style>
089. 
090.    <%-- Lightbox for poping up images (viewer)  --%>
091.    <script src="../scripts/lightbox.js" type="text/javascript"></script>   
092.    <link href="../styles/lightbox.css" rel="stylesheet" />
093.     
094.</asp:Content>
095. 
096.<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
097. 
098.    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
099.        <AjaxSettings>
100.            <telerik:AjaxSetting AjaxControlID="RadDataPager3">
101.                <UpdatedControls>
102.                    <telerik:AjaxUpdatedControl ControlID="Panel1"  />                   
103.                </UpdatedControls>
104.            </telerik:AjaxSetting>
105.            <telerik:AjaxSetting AjaxControlID="RadDataPager4">
106.                <UpdatedControls>
107.                    <telerik:AjaxUpdatedControl ControlID="Panel1"  />                   
108.                </UpdatedControls>
109.            </telerik:AjaxSetting>           
110.            <telerik:AjaxSetting AjaxControlID="RadListViewStoreItems">
111.                <UpdatedControls>
112.                    <telerik:AjaxUpdatedControl ControlID="Panel1"  />                   
113.                </UpdatedControls>
114.            </telerik:AjaxSetting>
115.          
116.        </AjaxSettings>
117.        <ClientEvents OnResponseEnd="OnResponseEnd" OnRequestStart="OnRequestStart"/>
118.    </telerik:RadAjaxManager>
119. 
120.    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" ToolTip="Please wait..." Height="50px" Width="50px"/>   
121.    <telerik:RadWindowManager runat="server" ID="RadWindowManager1" EnableShadow="true"  />        
122. 
123.    <%-- store items --%>
124.    <fieldset id="FieldSet1" style="width: 100%; height: 100%;" class="ui-widget ui-widget-content ui-corner-all">
125.        <legend id="Legend1" class="ui-widget-header ui-corner-all">  Your Store  </legend>
126. 
127.        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1"
128.            ClientEvents-OnRequestStart="OnRequestStart" ClientEvents-OnResponseEnd="OnResponseEnd">
129. 
130.        <asp:Panel runat="server" ID="Panel1" Width="970px" Height='<%#HeightPage%>'>
131.                         
132.            <div style="float: left; width: 100%; margin: 10px;">
133.                <telerik:RadDataPager ID="RadDataPager3" runat="server" PagedControlID="RadListViewStoreItems" Width="95%">
134.                    <Fields>
135.                        <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
136.                        <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="6" />
137.                        <telerik:RadDataPagerButtonField FieldType="NextLast" />
138.                        <telerik:RadDataPagerPageSizeField PageSizeComboWidth="60" PageSizeText="Page size: " />
139.                        <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go" TextBoxWidth="25" />
140.                    </Fields>
141.                </telerik:RadDataPager>
142.            </div>
143. 
144.            <div style="float: left; width: 100%; " >
145. 
146.                <telerik:RadListView runat="server" ID="RadListViewStoreItems" ItemPlaceholderID="StorePlaceHolder" DataKeyNames="StoreItemId, StoreItemGroupId">
147.                    <LayoutTemplate>
148.                        <fieldset>
149.                            <div style="float: left; width: 100%; padding: 5px;">
150.                                <asp:PlaceHolder ID="StorePlaceHolder" runat="server" />
151.                            </div>
152.                        </fieldset>
153.                    </LayoutTemplate>
154. 
155.                    <ItemTemplate>
156. 
157.                        <%--  hidden id fields --%>
158.                        <div style="display: none;">
159.                            <telerik:RadTextBox runat="server" ID="RadTextBoxStoreItemId" Text='<%# Eval("StoreItemId") %>' />
160.                            <telerik:RadTextBox runat="server" ID="RadTextBoxApplicationId" Text='<%# Eval("ApplicationId") %>' />
161.                            <telerik:RadTextBox runat="server" ID="RadTextBoxName" Text='<%# Eval("Name") %>' />
162.                            <telerik:RadTextBox runat="server" ID="RadTextBoxDescription" Text='<%# Eval("Description") %>' />
163.                            <telerik:RadTextBox runat="server" ID="RadTextBoxUseStockLevel" Text='<%# Eval("UseStockLevel")%>' />
164.                            <telerik:RadTextBox runat="server" ID="RadTextBoxStockLevel" Text='<%# Eval("StockLevel")%>' />
165.                            <telerik:RadTextBox runat="server" ID="RadTextBoxSKU" Text='<%# Eval("SKU") %>' />
166.                            <telerik:RadTextBox runat="server" ID="RadTextBoxOptions" Text='<%# Eval("Color")%>' />
167.                            <telerik:RadTextBox runat="server" ID="RadTextBoxListPrice" Text='<%# Eval("ListPrice") %>' />
168.                            <telerik:RadTextBox runat="server" ID="RadTextBoxDiscountedPrice" Text='<%# Eval("DiscountedPrice")%>' />
169.                            <telerik:RadTextBox runat="server" ID="RadTextBoxDiscountedPct" Text='<%# Eval("DiscountedPct")%>' />
170.                            <telerik:RadTextBox runat="server" ID="RadTextBoxDiscountStartDate" Text='<%# Eval("DiscountStartDate")%>' />
171.                            <telerik:RadTextBox runat="server" ID="RadTextBoxDiscountEndDate" Text='<%# Eval("DiscountEndDate")%>' />
172.                            <telerik:RadButton runat="server" ID="RadButtonUseDiscount" Checked='<%# Eval("UseDiscount")%>' />
173.                            <telerik:RadTextBox runat="server" ID="RadTextBoxOnlinePrice" Text='<%# Eval("OnlinePrice") %>' />
174.                            <telerik:RadTextBox runat="server" ID="RadTextBoxCost" Text='<%# Eval("Cost") %>' />
175.                            <telerik:RadTextBox runat="server" ID="RadTextBoxWeight" Text='<%# Eval("Weight") %>' />
176.                        </div>
177. 
178.                        <div id="divItemTemplate" runat="server" style="float: left; background-color:rebeccapurple">
179.                            <%--main item block - width and height determined by the application--%>
180.                            <fieldset id="FieldSetItem" runat="server" style="float: left; margin-top: 10px; width: 97%; height:350px;" class="ui-widget ui-widget-content ui-corner-all">
181.                                <legend id="Legend1" style="text-align: center;" class="ui-widget-header ui-corner-all">  <b><%#Eval("Name")%></b>  </legend>
182.                                <%--main wrapper for the item in the fieldset--%>
183.                                <div style="float: left; width: 100%;">
184.                                    <div style="float: left; width: 100%; margin-top: 5px; margin-bottom: 5px; background-color: lightgreen;">
185.                                        <%--<asp:Label ID="Label4" runat="server" Text="TOP" />--%>
186.                                        <asp:PlaceHolder runat="server" ID="PlaceHolderTop" />
187.                                    </div>
188.                                    <div style="float: left; width: 100%;">
189.                                        <div runat="server" id="divLeft" style="float: left; margin-right: 5px; background-color: fuchsia;">
190.                                            <%--<asp:Label runat="server" Text="LEFT" />--%>
191.                                            <asp:PlaceHolder runat="server" ID="PlaceHolderLeft" />
192.                                        </div>
193.                                        <div runat="server" id="divCenter" style="float: left; margin-right: 5px; background-color: coral;">
194.                                            <%--<asp:Label ID="Label1" runat="server" Text="CENTER" />--%>
195.                                            <asp:PlaceHolder runat="server" ID="PlaceHolderCenter" />
196.                                        </div>
197.                                        <div runat="server" id="divRight" style="float: left; background-color: darkgray;">
198.                                            <%--<asp:Label ID="Label2" runat="server" Text="RIGHT" />--%>
199.                                            <asp:PlaceHolder runat="server" ID="PlaceHolderRight" />
200.                                        </div>
201.                                    </div>
202.                                    <div style="float: left; width: 100%; margin-top: 5px; margin-bottom: 5px; background-color: lightgreen;">
203.                                        <%--<asp:Label ID="Label3" runat="server" Text="BOTTOM" />--%>
204.                                        <asp:PlaceHolder runat="server" ID="PlaceHolderBottom" />
205.                                    </div>
206.                                </div>
207.                            </fieldset>                           
208.                        </div>
209. 
210.                    </ItemTemplate>
211.                </telerik:RadListView>
212. 
213.            </div>
214. 
215.            <div style="float: left; width: 100%; margin: 10px;">
216.                <telerik:RadDataPager ID="RadDataPager4" runat="server" PagedControlID="RadListViewStoreItems" Width="95%">
217.                    <Fields>
218.                        <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
219.                        <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="6" />
220.                        <telerik:RadDataPagerButtonField FieldType="NextLast" />
221.                        <telerik:RadDataPagerPageSizeField PageSizeComboWidth="60" PageSizeText="Page size: " />
222.                        <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go" TextBoxWidth="25" />
223.                    </Fields>
224.                </telerik:RadDataPager>
225.            </div>
226. 
227.        </asp:Panel>
228. 
229.        </telerik:RadAjaxPanel>
230.    </fieldset>
231. 
232.    <telerik:RadLightBox ID="RadLightBox1" runat="server" Modal="true" LoopItems="true" ZIndex="100000">
233.        <ClientSettings AllowKeyboardNavigation="true" NavigationMode="Zone">
234.            <AnimationSettings HideAnimation="Fade" NextAnimation="Fade" PrevAnimation="Fade" ShowAnimation="Fade" />
235.        </ClientSettings>
236.    </telerik:RadLightBox>
237. 
238.    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
239.        <script type="text/javascript">
240. 
241.            function OpenRadLigthBox(index) {
242.                var lightBox = $find('<%= RadLightBox1.ClientID %>');
243.                lightBox.set_currentItemIndex(index);
244.                lightBox.show();
245.            }
246. 
247.            function OnResponseEnd(sender, eventArgs) {
248.                //alert('Response END initiated by: ' + eventArgs.get_eventTarget());
249.                document.body.style.cursor = "default";
250.                // function in MasterPage               
251.                ContinueSession;
252.            }
253. 
254.            function OnRequestStart(sender, eventArgs) {
255.                //alert('Response START initiated by: ' + eventArgs.get_eventTarget());
256.                document.body.style.cursor = "wait";
257.            }
258. 
259.        </script>
260.    </telerik:RadScriptBlock>
261. 
262.</asp:Content>


vb
0001.Imports System.Data
0002.Imports Telerik.Web.UI
0003.Imports System.IO
0004. 
0005. 
0006.Partial Class Default2
0007.    Inherits System.Web.UI.Page
0008. 
0009. 
0010.#Region " Declarations "
0011. 
0012.    Const ImageInfo As String = "../images/common/info-24.png"
0013.    Const ImageMajorrError As String = "../images/problem-major-32.png"
0014.    Const ImageMinorError As String = "../images/problem-minor-32.png"
0015.    Const ImageEmailSent As String = "../images/email-24.png"
0016. 
0017.#End Region
0018. 
0019.#Region " Data Properties "
0020. 
0021.    ''' <summary>
0022.    ''' Get the MyRSI_StoreItems_tbl datatable.
0023.    ''' </summary>
0024.    ''' <remarks></remarks>
0025.    Private ReadOnly Property GetStoreItemsWithGrpsDT() As DataTable
0026.        Get
0027. 
0028.            Dim StoreItemsDT As DataTable = Nothing
0029. 
0030.            ' make sure we are disposing
0031.            Using myManager As New cMyManager()
0032.                ' make sure we are disposing
0033.                Using MyRSI_StoreItems_tbl As New cMyManager.RSI_StoreItems_tbl(myManager)
0034.                    Using MyRSI_cMyHelper As New cMyManager.cMyHelper()
0035.                        With MyRSI_StoreItems_tbl
0036. 
0037.                            Dim myStoreItemGroupId As Long = myManager.DefaultID()
0038. 
0039.                            StoreItemsDT = myManager.MyDb.GetDataTable(.GetSQLQueryWithGroups(myManager.ApplicationId(), True))
0040. 
0041.                            'MyRSI_cMyHelper.ShowNotepad(.GetSQLQuery(myManager.ApplicationId(), myManager.DefaultID(), myManager.DefaultID(), True))
0042. 
0043.                            If StoreItemsDT IsNot Nothing Then
0044. 
0045.                                'StoreItemsDT.Columns("Image").DataType.ToString()
0046. 
0047.                                For Each myDataRow As DataRow In StoreItemsDT.Rows
0048.                                    If myDataRow("ImageThumbnail") Is DBNull.Value Then
0049.                                        myDataRow("ImageThumbnail") = MyRSI_cMyHelper.GetBytes(Server.MapPath("~/RegisterPro/images/Common/not-avail-24.png"))
0050.                                        StoreItemsDT.AcceptChanges()
0051.                                    End If
0052.                                    If myDataRow("StoreItemGroupId") Is DBNull.Value Then
0053.                                        myDataRow("StoreItemGroupId") = myManager.DefaultID()
0054.                                    End If
0055.                                Next
0056. 
0057.                                ' we need to remove the rows we dont need
0058.                                ' if we are Delete() - you cant go "Next" indexes are messed up, so exit for
0059.                                ' you have to Step -1
0060.                                For i As Integer = StoreItemsDT.Rows.Count - 1 To 0 Step -1
0061.                                    If myStoreItemGroupId <> StoreItemsDT.Rows(i)("StoreItemGroupId") Then
0062.                                        myStoreItemGroupId = StoreItemsDT.Rows(i)("StoreItemGroupId")
0063.                                    ElseIf StoreItemsDT.Rows(i)("StoreItemGroupId") <> myManager.DefaultID() Then
0064.                                        StoreItemsDT.Rows(i).Delete()
0065.                                    End If
0066.                                Next
0067. 
0068.                            End If
0069. 
0070. 
0071.                        End With
0072. 
0073.                    End Using
0074.                End Using
0075. 
0076.                myManager.Close()
0077. 
0078.            End Using
0079. 
0080.            Return StoreItemsDT
0081. 
0082.        End Get
0083.    End Property
0084. 
0085.    Private ReadOnly Property GetStoreItemsWithGrpsDT(ByVal MyStoreItemGroupId As Long, ByVal MyProductLayoutItems As cMyManager.ProductLayoutItems) As DataTable
0086.        Get
0087. 
0088.            Dim StoreItemsDT As DataTable = Nothing
0089. 
0090.            ' make sure we are disposing
0091.            Using myManager As New cMyManager()
0092.                ' make sure we are disposing
0093.                Using MyRSI_StoreItems_tbl As New cMyManager.RSI_StoreItems_tbl(myManager)
0094.                    Using MyRSI_cMyHelper As New cMyManager.cMyHelper()
0095.                        With MyRSI_StoreItems_tbl
0096. 
0097.                            StoreItemsDT = myManager.MyDb.GetDataTable(.GetSQLQueryWithGroups(MyStoreItemGroupId, MyProductLayoutItems))
0098. 
0099.                            'Using cmyHelper As New cMyManager.cMyHelper(myManager)
0100.                            '    cmyHelper.ShowNotepad(.GetSQLQueryWithGroups(MyStoreItemGroupId, MyProductLayoutItems))
0101.                            'End Using
0102.                        End With
0103.                    End Using
0104.                End Using
0105. 
0106.                myManager.Close()
0107. 
0108.            End Using
0109. 
0110.            Return StoreItemsDT
0111. 
0112.        End Get
0113.    End Property
0114. 
0115.    Private ReadOnly Property GetStoreSettings(ByVal cMyManager As cMyManager) As DataTable
0116.        Get
0117. 
0118.            ' make sure we are disposing
0119.            Using RSI_StoreSettings_tbl As New cMyManager.RSI_StoreSettings_tbl(cMyManager)
0120. 
0121.                With RSI_StoreSettings_tbl
0122.                    Return cMyManager.MyDb.GetDataTable(.GetSQLQuery())
0123.                End With
0124. 
0125.                'Using MyRSI_cMyHelper As New cMyManager.cMyHelper()
0126.                'MyRSI_cMyHelper.ShowNotepad(.GetSQLQuery(myManager.ApplicationId(), myManager.DefaultID(), myManager.DefaultID(), True))
0127.                'End Using
0128. 
0129.            End Using
0130. 
0131.            Return Nothing
0132. 
0133.        End Get
0134.    End Property
0135. 
0136.    Private ReadOnly Property GetGalleryImages(ByVal StoreItemId As Long, ByVal cMyManager As cMyManager) As DataTable
0137.        Get
0138. 
0139.            ' make sure we are disposing
0140.            Using RSI_StoreImages_tbl As New cMyManager.RSI_StoreImages_tbl(cMyManager)
0141. 
0142.                With RSI_StoreImages_tbl
0143.                    Return cMyManager.MyDb.GetDataTable(.GetSQLQuery(StoreItemId))
0144.                End With
0145. 
0146.                'Using MyRSI_cMyHelper As New cMyManager.cMyHelper()
0147.                'MyRSI_cMyHelper.ShowNotepad(.GetSQLQuery(myManager.ApplicationId(), myManager.DefaultID(), myManager.DefaultID(), True))
0148.                'End Using
0149. 
0150.            End Using
0151. 
0152.            Return Nothing
0153. 
0154.        End Get
0155.    End Property
0156. 
0157.#End Region
0158. 
0159.    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
0160. 
0161.        If Me.IsPostBack Then Return
0162. 
0163.        Using cMyManager As New cMyManager()
0164.            Using cMyHelper As New cMyManager.cMyHelper(cMyManager)
0165. 
0166.                ' get the store settings
0167.                Dim myDataTable As DataTable = Me.GetStoreSettings(cMyManager)
0168.                Dim myVerCount As Int16 = -1
0169.                Dim myHorCount As Int16 = -1
0170.                Dim myUseStorePaging As Boolean = False
0171. 
0172.                If myDataTable IsNot Nothing Then
0173.                    If myDataTable.Rows.Count > 0 Then
0174. 
0175.                        Dim myDataRow As DataRow = myDataTable.Rows(0)
0176. 
0177.                        ' get data
0178.                        myVerCount = myDataRow("ItemsVerLayout")
0179.                        myHorCount = myDataRow("ItemsHorLayout")
0180.                        myUseStorePaging = myDataRow("UseStorePaging")
0181.                        myHorCount = 3
0182.                        'set data
0183.                        Me.RadListViewStoreItems.AllowPaging = myUseStorePaging
0184.                        If myUseStorePaging Then
0185.                            Me.RadListViewStoreItems.PageSize = myVerCount * myHorCount
0186.                        End If
0187. 
0188.                        Me.RadDataPager3.Visible = myUseStorePaging
0189.                        Me.RadDataPager4.Visible = myUseStorePaging
0190. 
0191.                        ' set up the viewstate
0192.                        ViewState.Add("ItemsVerLayout", myVerCount) ' can be 1-30 (rows)
0193.                        ViewState.Add("ItemsHorLayout", myHorCount) ' can be 1-3 (columns)
0194. 
0195.                        Dim myItemWidth As Int32 = 950
0196.                        If myHorCount = 2 Then myItemWidth = Math.Floor(945 / myHorCount)
0197.                        If myHorCount = 3 Then myItemWidth = Math.Floor(880 / myHorCount)
0198. 
0199.                        ViewState.Add("ItemWidth", Unit.Pixel(myItemWidth))  ' this is the actual item box width (1, 2, or 3 a row)
0200.                        ViewState.Add("ItemHeight", Unit.Pixel(350))    ' always 350 pixels
0201.                        ViewState.Add("HeightPage", Unit.Pixel(350 * myVerCount))    ' always 400 pixels
0202.                        ViewState.Add("UseStorePaging", myUseStorePaging)   ' using paging or not
0203.                        ViewState.Add("HorCount", myHorCount)   ' horizontal count of items
0204. 
0205.                        ' items in the layout
0206.                        ViewState.Add("LayoutTop", myDataRow("LayoutTop"))
0207.                        ViewState.Add("LayoutLeft", myDataRow("LayoutLeft"))
0208.                        ViewState.Add("LayoutCenter", myDataRow("LayoutCenter"))
0209.                        ViewState.Add("LayoutRight", myDataRow("LayoutRight"))
0210.                        ViewState.Add("LayoutBottom", myDataRow("LayoutBottom"))
0211. 
0212.                        ' layout diagram
0213.                        '-----[1]-----      {TopBottomWidth}
0214.                        '-[2]-[3]-[4]-      {LeftWidth} - {CenterWidth} - {RightWidth}
0215.                        '-----[5]-----      {TopBottomWidth}
0216. 
0217.                        ' normal layout - every container has items
0218.                        ViewState.Add("TopBottomWidth", myItemWidth - 35)    ' {1} top/ {5} bottom width of items in the container
0219.                        If myHorCount = 1 Then
0220.                            ViewState.Add("LeftWidth", ((myItemWidth) - 42) / 3)         ' {2} left width of item in the container
0221.                            ViewState.Add("CenterWidth", ((myItemWidth) - 42) / 3)       ' {3} left width of item in the container
0222.                            ViewState.Add("RightWidth", ((myItemWidth) - 42) / 3)        ' {4} left width of item in the container
0223.                        ElseIf myHorCount = 2 Then
0224.                            ViewState.Add("LeftWidth", ((myItemWidth) - 35) / 3)         ' {2} left width of item in the container
0225.                            ViewState.Add("CenterWidth", ((myItemWidth) - 35) / 3)       ' {3} left width of item in the container
0226.                            ViewState.Add("RightWidth", ((myItemWidth) - 35) / 3)        ' {4} left width of item in the container
0227.                        Else
0228.                            ViewState.Add("LeftWidth", ((myItemWidth) - 38) / 3)         ' {2} left width of item in the container
0229.                            ViewState.Add("CenterWidth", ((myItemWidth) - 38) / 3)       ' {3} left width of item in the container
0230.                            ViewState.Add("RightWidth", ((myItemWidth) - 38) / 3)        ' {4} left width of item in the container
0231.                        End If
0232. 
0233.                        ' widths are all based off of the middle cubes {2}, {3}, {4}
0234.                        ' lets get the multiplier - the width that is multiplied by the multiplier
0235.                        If myDataRow("LayoutLeft").ToString().Trim().Length() = 0 Then
0236.                            If myDataRow("LayoutCenter").ToString().Trim().Length() = 0 Then
0237.                                ' nothing in the left/center placeholder so lets add extra room in right cube
0238.                                ViewState("RightWidth") *= 3
0239.                                ViewState("RightWidth") += 10    ' add the margin-right: 5px back in twice
0240.                            ElseIf myDataRow("LayoutRight").ToString().Trim().Length() = 0 Then
0241.                                ' left/right placeholder is empty
0242.                                ViewState("CenterWidth") *= 3
0243.                                ViewState("CenterWidth") += 10   ' add the margin-right: 5px back in twice
0244.                            Else
0245.                                ' only the left placeholder is empty
0246.                                ViewState("RightWidth") *= 2
0247.                                ViewState("RightWidth") += 5    ' add the margin-right: 5px back in
0248.                            End If
0249.                        ElseIf myDataRow("LayoutCenter").ToString().Trim().Length() = 0 Then
0250.                            If myDataRow("LayoutRight").ToString().Trim().Length() = 0 Then
0251.                                ' we are missing center and right so extend the left
0252.                                ViewState("LeftWidth") *= 3
0253.                                ViewState("LeftWidth") += 10    ' add the margin-right: 5px back in twice
0254.                            Else
0255.                                ' only the center placeholder is empty
0256.                                ViewState("RightWidth") *= 2
0257.                                ViewState("RightWidth") += 5    ' add the margin-right: 5px back in
0258.                            End If
0259.                        ElseIf myDataRow("LayoutRight").ToString().Trim().Length() = 0 Then
0260.                            ViewState("CenterWidth") *= 2
0261.                            ViewState("CenterWidth") += 5    ' add the margin-right: 5px back in
0262.                        End If
0263. 
0264.                        ' add other items to viewstate
0265.                        ViewState.Add("CurrentDateTime", cMyManager.GetClientDateTimeNow())
0266. 
0267.                    End If
0268. 
0269.                End If
0270. 
0271.            End Using
0272.        End Using
0273. 
0274. 
0275.    End Sub
0276. 
0277.    Protected Sub RadListViewStoreItems_ItemCreated(sender As Object, e As RadListViewItemEventArgs) Handles RadListViewStoreItems.ItemCreated
0278. 
0279.        If TypeOf e.Item Is RadListViewDataItem Then
0280. 
0281.            Dim myRadListViewDataItem As RadListViewDataItem = DirectCast(e.Item, RadListViewDataItem)
0282.            Dim myPlaceHolder As UI.WebControls.PlaceHolder = Nothing
0283.            Dim mySplit() As String
0284. 
0285.            Using cMyManager As New cMyManager()
0286.                Using cMyHelper As New cMyManager.cMyHelper(cMyManager)
0287. 
0288.                    Dim myProductLayoutItems As cMyManager.ProductLayoutItems = Global.cMyManager.ProductLayoutItems.Name
0289.                    Dim myDiv As HtmlGenericControl = Nothing
0290.                    Dim myHasControls As Boolean = False
0291.                    Dim myStoreItemId As Long = myRadListViewDataItem.GetDataKeyValue("StoreItemId")
0292. 
0293.                    ' top ---------------------------------------------------------------------------------------------------------------------------------
0294.                    myPlaceHolder = TryCast(myRadListViewDataItem.FindControl("PlaceHolderTop"), UI.WebControls.PlaceHolder)
0295.                    ' see who is in the top
0296.                    mySplit = Split(ViewState("LayoutTop"), "|")
0297.                    For Each myElement As String In mySplit
0298.                        If IsNumeric(myElement) Then
0299.                            myHasControls = True
0300.                            myProductLayoutItems = myElement
0301.                            ' insert the control
0302.                            Me.AddControl(myRadListViewDataItem, myProductLayoutItems, 0, myPlaceHolder, cMyManager)
0303.                        End If
0304.                    Next
0305.                    myPlaceHolder.Visible = myHasControls
0306.                    ' reset
0307.                    myHasControls = False
0308.                    ' ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0309. 
0310.                    ' left ---------------------------------------------------------------------------------------------------------------------------------
0311.                    myPlaceHolder = TryCast(myRadListViewDataItem.FindControl("PlaceHolderLeft"), UI.WebControls.PlaceHolder)
0312.                    ' see who is in the left
0313.                    mySplit = Split(ViewState("LayoutLeft"), "|")
0314.                    For Each myElement As String In mySplit
0315.                        If IsNumeric(myElement) Then
0316.                            myHasControls = True
0317.                            myProductLayoutItems = myElement
0318.                            ' insert the control
0319.                            Me.AddControl(myRadListViewDataItem, myProductLayoutItems, 1, myPlaceHolder, cMyManager)
0320.                        End If
0321.                    Next
0322.                    myDiv = TryCast(myRadListViewDataItem.FindControl("divLeft"), HtmlGenericControl)
0323.                    myDiv.Style.Remove("width")
0324.                    myDiv.Style.Add("width", ViewState("LeftWidth") & "px")
0325.                    If Not myHasControls Then
0326.                        myDiv.Style.Add("display", "none")
0327.                    End If
0328.                    'myDiv.Style.Add("background-color", "purple")
0329.                    ' reset
0330.                    myHasControls = False
0331.                    ' ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0332. 
0333.                    ' center ---------------------------------------------------------------------------------------------------------------------------------
0334.                    myPlaceHolder = TryCast(myRadListViewDataItem.FindControl("PlaceHolderCenter"), UI.WebControls.PlaceHolder)
0335.                    ' see who is in the center
0336.                    mySplit = Split(ViewState("LayoutCenter"), "|")
0337.                    For Each myElement As String In mySplit
0338.                        If IsNumeric(myElement) Then
0339.                            myHasControls = True
0340.                            myProductLayoutItems = myElement
0341.                            ' insert the control
0342.                            Me.AddControl(myRadListViewDataItem, myProductLayoutItems, 2, myPlaceHolder, cMyManager)
0343.                        End If
0344.                    Next
0345.                    myDiv = TryCast(myRadListViewDataItem.FindControl("divCenter"), HtmlGenericControl)
0346.                    myDiv.Style.Add("width", ViewState("CenterWidth") & "px")
0347.                    If Not myHasControls Then
0348.                        myDiv.Style.Add("display", "none")
0349.                    End If
0350.                    'myDiv.Style.Add("background-color", "red")
0351.                    ' reset
0352.                    myHasControls = False
0353.                    ' ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0354. 
0355.                    ' right ---------------------------------------------------------------------------------------------------------------------------------
0356.                    myPlaceHolder = TryCast(myRadListViewDataItem.FindControl("PlaceHolderRight"), UI.WebControls.PlaceHolder)
0357.                    ' see who is in the right
0358.                    mySplit = Split(ViewState("LayoutRight"), "|")
0359.                    For Each myElement As String In mySplit
0360.                        If IsNumeric(myElement) Then
0361.                            myHasControls = True
0362.                            myProductLayoutItems = myElement
0363.                            ' insert the control
0364.                            Me.AddControl(myRadListViewDataItem, myProductLayoutItems, 3, myPlaceHolder, cMyManager)
0365.                        End If
0366.                    Next
0367.                    myDiv = TryCast(myRadListViewDataItem.FindControl("divRight"), HtmlGenericControl)
0368.                    myDiv.Style.Add("width", ViewState("RightWidth") & "px")
0369.                    If Not myHasControls Then
0370.                        myDiv.Style.Add("display", "none")
0371.                    End If
0372.                    'myDiv.Style.Add("background-color", "green")
0373.                    ' reset
0374.                    myHasControls = False
0375.                    ' ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0376. 
0377.                    ' bottom ---------------------------------------------------------------------------------------------------------------------------------
0378.                    myPlaceHolder = TryCast(myRadListViewDataItem.FindControl("PlaceHolderBottom"), UI.WebControls.PlaceHolder)
0379.                    ' see who is in the bottom
0380.                    mySplit = Split(ViewState("LayoutBottom"), "|")
0381.                    For Each myElement As String In mySplit
0382.                        If IsNumeric(myElement) Then
0383.                            myHasControls = True
0384.                            myProductLayoutItems = myElement
0385.                            ' insert the control
0386.                            Me.AddControl(myRadListViewDataItem, myProductLayoutItems, 4, myPlaceHolder, cMyManager)
0387.                        End If
0388.                    Next
0389.                    myPlaceHolder.Visible = myHasControls
0390.                    ' reset
0391.                    myHasControls = False
0392.                    ' ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0393. 
0394.                    Dim myHorCount As Int16 = ViewState("ItemsHorLayout")
0395. 
0396.                    Dim myFieldSetItem As HtmlGenericControl = Nothing
0397.                    myFieldSetItem = TryCast(myRadListViewDataItem.FindControl("FieldSetItem"), HtmlGenericControl)
0398.                    myDiv = TryCast(myRadListViewDataItem.FindControl("divItemTemplate"), HtmlGenericControl)
0399. 
0400.                    If myHorCount = 1 Then
0401.                        ' lets adjust the 'margin-right' for the items
0402.                        myDiv.Style.Remove("width")
0403.                        myDiv.Style.Add("width", "99%")
0404.                        myFieldSetItem.Style.Remove("width")
0405.                        myFieldSetItem.Style.Add("width", "97%")
0406.                    ElseIf myHorCount = 2 Then
0407.                        ' lets adjust the 'margin-right' for the items
0408.                        myDiv.Style.Remove("width")
0409.                        myDiv.Style.Add("width", "49.5%")
0410.                        myFieldSetItem.Style.Remove("width")
0411.                        myFieldSetItem.Style.Add("width", "95%")
0412.                    Else    ' 3 items across
0413.                        ' lets adjust the 'margin-right' for the items
0414.                        myDiv = TryCast(myRadListViewDataItem.FindControl("FieldSetItem"), HtmlGenericControl)
0415.                        myDiv.Style.Remove("width")
0416.                        myDiv.Style.Add("width", "33%")
0417.                    End If
0418. 
0419.                End Using
0420.            End Using
0421. 
0422.        End If
0423. 
0424.    End Sub
0425. 
0426.    ''' <summary>
0427.    ''' Add the control dynamically to the RadListView ItemTemplate.
0428.    ''' </summary>
0429.    ''' <param name="MyRadListViewDataItem">The radlistviewitem that we adding controls from its values</param>
0430.    ''' <param name="ProductLayoutItems">The ProductLayoutItem the client has picked for this product to display</param>
0431.    ''' <param name="MyPos">The position of the LayoutItem - 0(top), 1(left), 2(center), 3(right), 4(bottom)</param>
0432.    ''' <param name="MyPlaceHolder">The actual placeholder for the items to be created in</param>
0433.    ''' <param name="cMyManager"></param>
0434.    ''' <remarks></remarks>
0435.    Private Sub AddControl(ByVal MyRadListViewDataItem As RadListViewDataItem, ByVal ProductLayoutItems As cMyManager.ProductLayoutItems, ByVal MyPos As Int16, ByRef MyPlaceHolder As PlaceHolder, ByVal cMyManager As cMyManager)
0436. 
0437.        'Public Enum ProductLayoutItems
0438.        '    Name = 0
0439.        '    Description = 1
0440.        '    SKU = 2
0441.        '    Price = 3
0442.        '    Discount = 4
0443.        '    Image = 5
0444.        '    Purchase_Button = 6
0445.        '    Stock_Status = 7
0446.        '    Remaining_in_Stock = 8
0447.        '    Color_Option = 9
0448.        '    Size_Option = 10
0449.        '    Custom_Option = 11
0450.        'End Enum
0451. 
0452.        'Exit Sub
0453. 
0454.        Dim myStoreItemId As Long = MyRadListViewDataItem.GetDataKeyValue("StoreItemId")
0455.        Dim myStoreItemGroupId As Long = MyRadListViewDataItem.GetDataKeyValue("StoreItemGroupId")
0456.        Dim myLabel As New Label()
0457.        Dim myRadBinaryImage As New RadBinaryImage()
0458.        Dim myRadImageGallery As New RadImageGallery()
0459.        Dim myRadButton As New RadButton()
0460.        Dim myHtmlAnchor As New HtmlAnchor()    ' href link
0461.        Dim myHtmlGenericControl As New HtmlGenericControl()    ' div
0462.        Dim myHtmlGenericControlContain As New HtmlGenericControl()    ' div
0463.        Dim myRadNumericTextBox As New RadNumericTextBox()
0464.        Dim myRadToolTip As New RadToolTip()
0465.        Dim myRadComboBox As New RadComboBox()
0466.        Dim myWidth As Double = 0D
0467. 
0468.        ' all divs get these styles
0469.        myHtmlGenericControl.Style.Add("float", "left")
0470. 
0471.        ' container
0472.        myHtmlGenericControlContain.Style.Add("width", "100%")
0473.        myHtmlGenericControlContain.Style.Add("float", "left")
0474. 
0475.        ' get the placeholder position so we know what styles are needed for the divs
0476.        Select Case MyPos
0477.            Case ' top
0478.                myHtmlGenericControl.Style.Add("width", ViewState("TopBottomWidth") & "px")
0479.                myHtmlGenericControl.Style.Add("margin-left", "33%")
0480.                'myHtmlGenericControl.Style.Add("background-color", "blue")
0481.                myWidth = ViewState("TopBottomWidth") / 2
0482. 
0483.            Case ' left
0484.                myHtmlGenericControl.Style.Add("width", ViewState("LeftWidth") & "px")
0485.                'myHtmlGenericControl.Style.Add("background-color", "red")
0486.                myWidth = ViewState("LeftWidth")
0487. 
0488.            Case ' center
0489.                myHtmlGenericControl.Style.Add("width", ViewState("CenterWidth") & "px")
0490.                'myHtmlGenericControl.Style.Add("background-color", "green")
0491.                myWidth = ViewState("CenterWidth")
0492. 
0493.            Case ' right
0494.                myHtmlGenericControl.Style.Add("width", ViewState("RightWidth") & "px")
0495.                myHtmlGenericControl.Style.Add("margin-left", "2px")
0496.                'myHtmlGenericControl.Style.Add("background-color", "yellow")
0497.                myWidth = ViewState("RightWidth")
0498. 
0499.            Case ' bottom
0500.                myHtmlGenericControl.Style.Add("width", ViewState("TopBottomWidth") & "px")
0501.                myHtmlGenericControl.Style.Add("margin-left", "33%")
0502.                'myHtmlGenericControl.Style.Add("background-color", "orange")
0503.                myWidth = ViewState("TopBottomWidth")
0504. 
0505.        End Select
0506. 
0507. 
0508.        Select Case ProductLayoutItems
0509. 
0510.            Case cMyManager.ProductLayoutItems.Name
0511.                ' add the name
0512.                myLabel.ID = "LabelName"
0513.                myLabel.Width = New WebControls.Unit(Convert.ToDouble(myWidth))
0514.                AddHandler myLabel.DataBinding, AddressOf Name_DataBinding
0515. 
0516.                myHtmlGenericControlContain.Controls.Add(myLabel)
0517.                ' add to the div
0518.                myHtmlGenericControl.Controls.Add(myHtmlGenericControlContain)
0519. 
0520.                ' add to the placeholder
0521.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0522. 
0523.            Case cMyManager.ProductLayoutItems.Description
0524.                ' add the Description
0525.                myLabel.ID = "LabelDescription"
0526.                myLabel.Width = New WebControls.Unit(Convert.ToDouble(myWidth))
0527.                AddHandler myLabel.DataBinding, AddressOf Description_DataBinding
0528. 
0529.                ' add to the div
0530.                myHtmlGenericControl.Controls.Add(myLabel)
0531.                ' add to the placeholder
0532.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0533. 
0534.            Case cMyManager.ProductLayoutItems.SKU
0535.                ' add the Description
0536.                myLabel.ID = "LabelSKU"
0537.                myLabel.Width = New WebControls.Unit(Convert.ToDouble(myWidth))
0538.                AddHandler myLabel.DataBinding, AddressOf SKU_DataBinding
0539. 
0540.                ' add to the div
0541.                myHtmlGenericControl.Controls.Add(myLabel)
0542.                ' add to the placeholder
0543.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0544. 
0545.            Case cMyManager.ProductLayoutItems.Price
0546.                ' add the Price
0547.                myLabel.ID = "LabelPrice"
0548.                AddHandler myLabel.DataBinding, AddressOf Price_DataBinding
0549. 
0550.                ' add to the div
0551.                myHtmlGenericControl.Controls.Add(myLabel)
0552.                ' add to the placeholder
0553.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0554. 
0555.            Case cMyManager.ProductLayoutItems.Discount
0556.                ' add the Discount
0557.                myLabel.ID = "LabelDiscount"
0558.                AddHandler myLabel.DataBinding, AddressOf Discount_DataBinding
0559. 
0560.                ' add to the div
0561.                myHtmlGenericControl.Controls.Add(myLabel)
0562.                ' add to the placeholder
0563.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0564. 
0565.            Case cMyManager.ProductLayoutItems.Image
0566.                ' we first need to add a lightbox for it HREF LINK
0567.                myHtmlAnchor.ID = "LinkLightBox"
0568.                myHtmlAnchor.Target = "_blank"
0569.                myHtmlAnchor.Attributes("rel") = "lightbox"
0570.                AddHandler myHtmlAnchor.DataBinding, AddressOf HtmlAnchor_DataBinding
0571. 
0572.                ' add the Image to the HtmlAnchor
0573.                myRadBinaryImage.ID = "RadBinaryImage"
0574.                myRadBinaryImage.BorderStyle = BorderStyle.Ridge
0575.                myRadBinaryImage.BorderWidth = New WebControls.Unit(2)
0576.                myRadBinaryImage.ResizeMode = BinaryImageResizeMode.Crop
0577. 
0578.                myRadBinaryImage.Width = New WebControls.Unit(Convert.ToDouble(myWidth))
0579.                myRadBinaryImage.Height = New WebControls.Unit(Convert.ToDouble(myWidth))
0580. 
0581.                AddHandler myRadBinaryImage.DataBinding, AddressOf Image_DataBinding
0582. 
0583.                ' add the HtmlAnchor to the PlaceHolder
0584.                myHtmlAnchor.Controls.Add(myRadBinaryImage)
0585.                ' add to the div
0586.                myHtmlGenericControl.Controls.Add(myHtmlAnchor)
0587.                'myHtmlGenericControl.Controls.Add(myRadBinaryImage)
0588. 
0589.                myRadImageGallery.DisplayAreaMode = ImageGalleryDisplayAreaMode.LightBox
0590.                myRadImageGallery.ThumbnailListView.DataSource = Me.GetGalleryImages(myStoreItemId, cMyManager)
0591.                myRadImageGallery.ThumbnailsAreaSettings.ThumbnailsSpacing = New WebControls.Unit(3)
0592.                myRadImageGallery.ThumbnailsAreaSettings.Height = New WebControls.Unit(Convert.ToDouble(35))
0593.                myRadImageGallery.ThumbnailsAreaSettings.ShowScrollbar = False
0594.                myRadImageGallery.ThumbnailsAreaSettings.ShowScrollButtons = False
0595.                myRadImageGallery.ThumbnailsAreaSettings.Mode = ImageGalleryThumbnailsAreaMode.Thumbnails
0596.                myRadImageGallery.ThumbnailsAreaSettings.EnableZoneScroll = True
0597.                myRadImageGallery.ThumbnailListView.BorderStyle = BorderStyle.None
0598.                myRadImageGallery.Width = New WebControls.Unit(Convert.ToDouble(myWidth))
0599. 
0600.                ' set the h/w of each thumbnailLigyth
0601.                myRadImageGallery.ThumbnailsAreaSettings.ThumbnailHeight = New WebControls.Unit(28)
0602.                myRadImageGallery.ThumbnailsAreaSettings.ThumbnailWidth = New WebControls.Unit(28)
0603. 
0604. 
0605.                myRadImageGallery.DataSource = Me.GetGalleryImages(myStoreItemId, cMyManager)
0606.                myRadImageGallery.DataThumbnailField = "ImageThumbnail"
0607.                myRadImageGallery.DataImageField = "Image"
0608.                myRadImageGallery.DataBind()
0609. 
0610.                myHtmlGenericControl.Controls.Add(myRadImageGallery)
0611.                ' add to the placeholder
0612.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0613. 
0614.            Case cMyManager.ProductLayoutItems.Purchase_Button
0615.                ' need a div for the Purhcase BUuton items
0616.                'myHtmlGenericControlContain.Style.Add("text-align", "center")
0617.                'myHtmlGenericControlContain.Style.Add("vertical-align", "middle")
0618. 
0619.                '<asp:Label runat="server" Text="Quantity:" />
0620.                myLabel.Text = "<b>Quantity: </b>"
0621.                myHtmlGenericControlContain.Controls.Add(myLabel)   ' add the label
0622.                ' quantity box
0623.                myRadNumericTextBox.ID = "RadNumericTextBoxQuantity"
0624.                myRadNumericTextBox.MaxValue = 100
0625.                myRadNumericTextBox.MinValue = 1
0626.                myRadNumericTextBox.Value = 1
0627.                myRadNumericTextBox.Width = New WebControls.Unit(45)
0628.                myRadNumericTextBox.ShowSpinButtons = True
0629.                myRadNumericTextBox.IncrementSettings.Step = 1
0630.                myRadNumericTextBox.NumberFormat.DecimalDigits = 0
0631.                myRadNumericTextBox.EnabledStyle.Width = New WebControls.Unit(50)
0632.                myRadNumericTextBox.EnabledStyle.HorizontalAlign = HorizontalAlign.Center
0633.                myHtmlGenericControlContain.Controls.Add(myRadNumericTextBox)   ' add the label
0634. 
0635.                ' add the quatity (numeric control) and purchase button
0636.                myRadButton.ID = "RadButtonPurchase"
0637.                myRadButton.Text = "Add to Cart"
0638.                myRadButton.CommandName = "Submit"
0639.                myRadButton.CommandArgument = "Submit"
0640.                myRadButton.EnableViewState = True
0641.                myRadButton.UseSubmitBehavior = True
0642.                myRadButton.ButtonType = RadButtonType.StandardButton
0643.                myRadButton.ViewStateMode = UI.ViewStateMode.Enabled
0644.                myHtmlGenericControlContain.Controls.Add(myRadButton)   ' add the button
0645. 
0646.                ' add to the div
0647.                myHtmlGenericControl.Controls.Add(myHtmlGenericControlContain)
0648. 
0649.                ' extra style for button
0650.                myHtmlGenericControl.Style.Add("margin-top", "10px")
0651.                myHtmlGenericControl.Style.Add("margin-bottom", "10px")
0652. 
0653.                ' add to the placeholder
0654.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0655. 
0656.            Case cMyManager.ProductLayoutItems.Stock_Status
0657.                ' add the Stock Status
0658.                myLabel.ID = "LabelStockStatus"
0659.                AddHandler myLabel.DataBinding, AddressOf StockStatus_DataBinding
0660. 
0661.                ' add to the div
0662.                myHtmlGenericControl.Controls.Add(myLabel)
0663.                ' add to the placeholder
0664.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0665. 
0666.            Case cMyManager.ProductLayoutItems.Remaining_in_Stock
0667.                ' add the Stock Remain
0668.                myLabel.ID = "LabelStockRemain"
0669.                AddHandler myLabel.DataBinding, AddressOf StockLevel_DataBinding
0670. 
0671.                ' add to the div
0672.                myHtmlGenericControl.Controls.Add(myLabel)
0673.                ' add to the placeholder
0674.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0675. 
0676.            Case cMyManager.ProductLayoutItems.Color_Option ' could be combined item
0677. 
0678.                Dim myDataTable As DataTable = Me.GetStoreItemsWithGrpsDT(myStoreItemGroupId, ProductLayoutItems)
0679.                If myDataTable IsNot Nothing Then
0680.                    If myDataTable.Rows.Count < 1 Then
0681.                        ' we might need to add a label "Color" no combobox
0682.                        GoTo AddColorLabel
0683.                    End If
0684.                Else
0685.                    Exit Select
0686.                End If
0687. 
0688.                ' combobox - label and radcombobox
0689.                myLabel.ID = "LabelColor"
0690.                myLabel.Text = "<b>Color: </b>"
0691.                'AddHandler myLabel.DataBinding, AddressOf Color_DataBinding
0692.                myHtmlGenericControlContain.Controls.Add(myLabel)   ' add the label
0693. 
0694.                myRadComboBox.ID = "RadComboBoxColor"
0695.                myRadComboBox.DataSource = myDataTable
0696.                myRadComboBox.DataTextField = "Color"
0697.                myRadComboBox.DataValueField = "StoreItemId"
0698.                myRadComboBox.DataBind()
0699. 
0700.                'AddHandler myRadComboBox.DataBinding, AddressOf Color_DataBinding
0701.                myHtmlGenericControlContain.Controls.Add(myRadComboBox)   ' add the radcombobox
0702. 
0703.                ' add to the div
0704.                myHtmlGenericControl.Controls.Add(myHtmlGenericControlContain)
0705.                ' add to the placeholder
0706.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0707. 
0708.                Exit Select
0709. 
0710.AddColorLabel:
0711. 
0712.                ' label - there is not a grouped items
0713.                myLabel.ID = "LabelColor"
0714.                myLabel.Text = "<b>Color: </b>"
0715.                AddHandler myLabel.DataBinding, AddressOf Color_DataBinding
0716. 
0717.                ' add the label
0718.                myHtmlGenericControlContain.Controls.Add(myLabel)
0719.                ' add to the div
0720.                myHtmlGenericControl.Controls.Add(myHtmlGenericControlContain)
0721.                ' add to the placeholder
0722.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0723. 
0724.                Exit Select
0725. 
0726.            Case cMyManager.ProductLayoutItems.Size_Option ' could be combined item
0727. 
0728.                Dim myDataTable As DataTable = Me.GetStoreItemsWithGrpsDT(myStoreItemGroupId, ProductLayoutItems)
0729. 
0730.                If myDataTable IsNot Nothing Then
0731.                    If myDataTable.Rows.Count < 1 Then
0732.                        ' we might need to add a label "Color" no combobox
0733.                        GoTo AddSizeLabel
0734.                    End If
0735.                Else
0736.                    Exit Select
0737.                End If
0738. 
0739.                ' combobox - label and radcombobox
0740.                myLabel.ID = "LabelSize"
0741.                myLabel.Text = "<b>Size: </b>"
0742.                'AddHandler myLabel.DataBinding, AddressOf SizeString_DataBinding
0743.                myHtmlGenericControlContain.Controls.Add(myLabel)   ' add the label
0744. 
0745.                myRadComboBox.ID = "RadComboBoxSize"
0746.                myRadComboBox.AllowCustomText = False
0747.                myRadComboBox.MarkFirstMatch = True
0748.                myRadComboBox.Width = New WebControls.Unit(100D)
0749.                myRadComboBox.DataSource = myDataTable
0750.                If myDataTable.Rows(0)("SizeNumber") = "0.00" Then
0751.                    myRadComboBox.DataTextField = "SizeString"
0752.                Else
0753.                    myRadComboBox.DataTextField = "SizeNumber"
0754.                End If
0755.                myRadComboBox.DataValueField = "StoreItemId"
0756.                myRadComboBox.DataBind()
0757. 
0758.                'AddHandler myRadComboBox.DataBinding, AddressOf SizeString_DataBinding
0759.                myHtmlGenericControlContain.Controls.Add(myRadComboBox)   ' add the radcombobox
0760. 
0761.                ' add to the div
0762.                myHtmlGenericControl.Controls.Add(myHtmlGenericControlContain)
0763.                ' add to the placeholder
0764.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0765. 
0766.                Exit Select
0767. 
0768.AddSizeLabel:
0769. 
0770.                ' label - there is not a grouped items
0771.                myLabel.ID = "LabelSize"
0772.                myLabel.Text = "<b>Size: </b>"
0773.                AddHandler myLabel.DataBinding, AddressOf Size_DataBinding
0774. 
0775.                ' add the label
0776.                myHtmlGenericControlContain.Controls.Add(myLabel)
0777.                ' add to the div
0778.                myHtmlGenericControl.Controls.Add(myHtmlGenericControlContain)
0779.                ' add to the placeholder
0780.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0781. 
0782.                Exit Select
0783. 
0784.            Case cMyManager.ProductLayoutItems.Custom_Option ' could be combined item
0785. 
0786.                Dim myDataTable As DataTable = Me.GetStoreItemsWithGrpsDT(myStoreItemGroupId, ProductLayoutItems)
0787. 
0788.                If myDataTable IsNot Nothing Then
0789.                    If myDataTable.Rows.Count < 1 Then
0790.                        ' we might need to add a label "Color" no combobox
0791.                        GoTo AddCustomLabel
0792.                    End If
0793.                Else
0794.                    Exit Select
0795.                End If
0796. 
0797.                ' combobox - label and radcombobox
0798.                myLabel.ID = "LabelCustom"
0799.                myLabel.Text = "<b>Custom: </b>"
0800.                'AddHandler myLabel.DataBinding, AddressOf VarString_DataBinding
0801.                myHtmlGenericControlContain.Controls.Add(myLabel)   ' add the label
0802. 
0803.                myRadComboBox.ID = "RadComboBoxCustom"
0804.                myRadComboBox.AllowCustomText = False
0805.                myRadComboBox.MarkFirstMatch = True
0806.                myRadComboBox.Width = New WebControls.Unit(100D)
0807.                myRadComboBox.DataSource = myDataTable
0808.                myRadComboBox.DataTextField = "VarString"
0809.                myRadComboBox.DataValueField = "StoreItemId"
0810.                myRadComboBox.DataBind()
0811. 
0812.                'AddHandler myRadComboBox.DataBinding, AddressOf SizeString_DataBinding
0813.                myHtmlGenericControlContain.Controls.Add(myRadComboBox)   ' add the radcombobox
0814. 
0815.                ' add to the div
0816.                myHtmlGenericControl.Controls.Add(myHtmlGenericControlContain)
0817.                ' add to the placeholder
0818.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0819. 
0820.                Exit Select
0821. 
0822.AddCustomLabel:
0823. 
0824.                ' label - there is not a grouped items
0825.                myLabel.ID = "LabelCustom"
0826.                myLabel.Text = "<b>Custom: </b>"
0827.                AddHandler myLabel.DataBinding, AddressOf VarString_DataBinding
0828. 
0829.                ' add the label
0830.                myHtmlGenericControlContain.Controls.Add(myLabel)
0831.                ' add to the div
0832.                myHtmlGenericControl.Controls.Add(myHtmlGenericControlContain)
0833.                ' add to the placeholder
0834.                MyPlaceHolder.Controls.Add(myHtmlGenericControl)
0835. 
0836.                Exit Select
0837. 
0838.        End Select
0839. 
0840.    End Sub
0841. 
0842.#Region " Client Protected Methods "
0843. 
0844.    Sub Name_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0845.        Dim Label As Label = DirectCast(sender, Label)
0846.        Label.Text = "<b>Name:</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("NameTextHTML").ToString()
0847.    End Sub
0848.    Sub Description_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0849.        Dim Label As Label = DirectCast(sender, Label)
0850.        Label.Text = "<b>Description:</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("DescriptionTextHTML").ToString()
0851.    End Sub
0852.    Sub SKU_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0853.        Dim Label As Label = DirectCast(sender, Label)
0854.        Label.Text = "<b>SKU:</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("SKUTextHTML").ToString()
0855.    End Sub
0856.    Sub Price_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0857.        Dim Label As Label = DirectCast(sender, Label)
0858.        Dim myCurrency As Double = (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("ListPriceTextHTML").ToString()
0859.        Label.Text = "<b>Price:</b> " & Format(myCurrency, "$#,##0.00")
0860.    End Sub
0861.    Sub Discount_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0862.        Dim Label As Label = DirectCast(sender, Label)
0863.        Dim myUseDiscount As Boolean = Convert.ToBoolean((TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("UseDiscount"))
0864.        Dim myListPrice As Double = (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("ListPrice").ToString()
0865.        Dim myDiscountedPrice As Double = (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("DiscountedPrice").ToString()
0866.        Dim myDiscountedPct As Double = (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("DiscountedPct").ToString()
0867.        Dim myCurrentDateTime As DateTime = ViewState("CurrentDateTime")
0868. 
0869.        ' not using discount so hide and exit
0870.        If Not myUseDiscount Then Label.Visible = False : Exit Sub
0871. 
0872.        ' check for dates
0873.        Dim myStartDate As DateTime = Convert.ToDateTime((TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("DiscountStartDate"))
0874.        Dim myEndDate As DateTime = Convert.ToDateTime((TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("DiscountEndDate"))
0875. 
0876.        Dim myCurrency As Double = myDiscountedPrice
0877. 
0878.        ' its between the dates so we show the discount
0879.        If myStartDate < myCurrentDateTime And myEndDate > myCurrentDateTime Then
0880.            If myCurrency = 0 Then
0881.                ' get the percentage
0882.                myCurrency = (myListPrice * myDiscountedPct) / 100
0883.            End If
0884.        Else
0885.            ' its outside the date range so lets hide the discount
0886.            Label.Visible = False : Exit Sub
0887.        End If
0888. 
0889.        Label.Text = "<b>Price After Discount:</b> " & Format(myCurrency, "$#,##0.00")
0890. 
0891.        Label.Visible = myCurrency > 0D
0892.    End Sub
0893.    Sub StockStatus_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0894.        Dim Label As Label = DirectCast(sender, Label)
0895.        Label.Text = "<b>Stock Status:</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("StockStatusValuesId").ToString()
0896.        If Convert.ToInt64((TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("StockStatusValuesId").ToString()) < 0 Then
0897.            Label.Visible = False
0898.        End If
0899.    End Sub
0900.    Sub StockLevel_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0901.        Dim Label As Label = DirectCast(sender, Label)
0902.        Label.Text = "<b>Stock Level:</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("StockLevel").ToString()
0903. 
0904.        Dim myUseStockLevel As Boolean = Convert.ToBoolean((TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("UseStockLevel"))
0905.        Label.Visible = myUseStockLevel
0906. 
0907.    End Sub
0908.    Sub Image_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0909.        Dim myRadBinaryImage As RadBinaryImage = DirectCast(sender, RadBinaryImage)
0910.        myRadBinaryImage.DataValue = CType(DataBinder.Eval(CType(myRadBinaryImage.NamingContainer, RadListViewDataItem).DataItem, "ImageThumbnail"), Byte())
0911.        myRadBinaryImage.ToolTip = (TryCast((TryCast(myRadBinaryImage.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("Name").ToString()
0912.        myRadBinaryImage.AlternateText = (TryCast((TryCast(myRadBinaryImage.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("Name").ToString()
0913. 
0914.        'myRadBinaryImage.ClientSideEvents.Click = String.Format("function(s, e) { ShowPopup(s, e, {0}) }", DataBinder.Eval(container.DataItem, "ID"))
0915.    End Sub
0916.    Sub HtmlAnchor_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0917.        Dim myHtmlAnchor As HtmlAnchor = DirectCast(sender, HtmlAnchor)
0918.        Dim myStoreItemId As Long = (TryCast((TryCast(myHtmlAnchor.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("StoreItemId").ToString()
0919.        myHtmlAnchor.HRef = "~/RegisterPro/ImageHandler.ashx?Id=" & myStoreItemId & "&TableName=RSI_StoreImages_tbl"
0920.        'href='<%# Eval("StoreItemId", "~/RegisterPro/ImageHandler.ashx?Id={0}&TableName=RSI_StoreImages_tbl")%>'>
0921.    End Sub
0922.    Sub Color_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0923.        Dim Label As Label = DirectCast(sender, Label)
0924.        Label.Visible = (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("Color").ToString().Length > 0
0925.        Label.Text = "<b>Color:</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("Color").ToString()
0926.    End Sub
0927.    Sub Size_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0928.        Dim Label As Label = DirectCast(sender, Label)
0929.        If (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("SizeString").ToString().Length = 0 Then
0930.            If (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("SizeNumber").ToString() = "0.00" Then
0931.                ' we dont have a size - empty string and 0.00
0932.                Label.Visible = False
0933.            Else
0934.                ' we have a Number for size
0935.                Label.Text = "<b>Size:</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("SizeNumber").ToString()
0936.            End If
0937.        Else
0938.            ' we have a String for size
0939.            Label.Text = "<b>Size:</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("SizeString").ToString()
0940.        End If
0941. 
0942.    End Sub
0943.    Sub VarString_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
0944.        Dim Label As Label = DirectCast(sender, Label)
0945.        Label.Visible = (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("VarString").ToString().Length > 0
0946.        Dim myVarLabelName As String = (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("VarLabelName").ToString()
0947.        Label.Text = String.Concat("<b>", myVarLabelName, ":</b> " & (TryCast((TryCast(Label.NamingContainer, RadListViewDataItem)).DataItem, DataRowView))("VarString").ToString())
0948.    End Sub
0949. 
0950.    Protected ReadOnly Property ItemWidth() As Unit
0951.        Get
0952.            Return DirectCast(ViewState("ItemWidth"), Unit)
0953.        End Get
0954.    End Property
0955. 
0956.    Protected ReadOnly Property ItemHeight() As Unit
0957.        Get
0958.            Return DirectCast(ViewState("ItemHeight"), Unit)
0959.        End Get
0960.    End Property
0961. 
0962.    Protected ReadOnly Property HeightPage() As Unit
0963.        Get
0964.            Return DirectCast(ViewState("HeightPage"), Unit)
0965.        End Get
0966.    End Property
0967. 
0968.#End Region
0969. 
0970.    Protected Sub RadListViewStoreItems_NeedDataSource(sender As Object, e As Telerik.Web.UI.RadListViewNeedDataSourceEventArgs) Handles RadListViewStoreItems.NeedDataSource
0971.        Me.RadListViewStoreItems.DataSource = Me.GetStoreItemsWithGrpsDT()
0972.    End Sub
0973. 
0974.    Protected Sub RadListViewStoreItems_ItemCommand(sender As Object, e As Telerik.Web.UI.RadListViewCommandEventArgs) Handles RadListViewStoreItems.ItemCommand
0975. 
0976.        Dim myRadTextBox As RadTextBox = Nothing
0977.        Dim myRadNumericTextBox As RadNumericTextBox = Nothing
0978.        Dim myRadButton As RadButton = Nothing
0979.        Dim myAmount As Double = 0D
0980.        Dim myQuantity As Int32 = 1
0981.        Dim myStockLevel As Int32 = 1
0982.        Dim myStoreItemId As Long = 0
0983. 
0984.        Dim myName As String = String.Empty
0985.        Dim myDescription As String = String.Empty
0986.        Dim mySKU As String = String.Empty
0987. 
0988.        Dim myCurrentDateTime As DateTime = ViewState("CurrentDateTime")
0989.        Dim myListPrice As Double = 0D
0990. 
0991.        If e.CommandName = "Submit" Then
0992. 
0993.            If TypeOf e.ListViewItem Is RadListViewDataItem Then
0994. 
0995.                myRadTextBox = TryCast(e.ListViewItem.FindControl("RadTextBoxName"), RadTextBox)
0996.                myName = myRadTextBox.Text
0997.                myRadTextBox = TryCast(e.ListViewItem.FindControl("RadTextBoxDescription"), RadTextBox)
0998.                myDescription = myRadTextBox.Text
0999.                myRadTextBox = TryCast(e.ListViewItem.FindControl("RadTextBoxSKU"), RadTextBox)
1000.                mySKU = myRadTextBox.Text
1001.                myRadTextBox = TryCast(e.ListViewItem.FindControl("RadTextBoxStoreItemId"), RadTextBox)
1002.                myStoreItemId = myRadTextBox.Text
1003. 
1004.                myRadNumericTextBox = TryCast(e.ListViewItem.FindControl("RadNumericTextBoxQuantity"), RadNumericTextBox)
1005.                myQuantity = myRadNumericTextBox.Value
1006. 
1007. 
1008.                ' lets see if there is enough stock - they need to be using stock as well
1009.                myRadTextBox = TryCast(e.ListViewItem.FindControl("RadTextBoxUseStockLevel"), RadTextBox)
1010.                If Convert.ToBoolean(myRadTextBox.Text) = True Then
1011.                    myRadTextBox = TryCast(e.ListViewItem.FindControl("RadTextBoxStockLevel"), RadTextBox)
1012.                    myStockLevel = Convert.ToInt32(myRadTextBox.Text)
1013.                    If myStockLevel < myQuantity Then
1014.                        Me.RadWindowManager1.RadAlert(String.Concat("There are only <b>", myStockLevel, "</b> items left in stock for the <b>", myName, "</b> product.<br /><br />Please adjusst your quantity."), 500, 200, "Inventory Low", String.Empty, ImageMinorError)
1015.                        e.Canceled = True
1016.                        Exit Sub
1017.                    End If
1018.                End If
1019. 
1020.                ' check price and see discount - preset to ListPrice
1021.                myListPrice = TryCast(e.ListViewItem.FindControl("RadTextBoxListPrice"), RadTextBox).Text
1022.                If TryCast(e.ListViewItem.FindControl("RadButtonUseDiscount"), RadButton).Checked Then
1023.                    ' using discount
1024.                    Dim myStartDate As DateTime = TryCast(e.ListViewItem.FindControl("RadTextBoxDiscountStartDate"), RadTextBox).Text
1025.                    Dim myEndDate As DateTime = TryCast(e.ListViewItem.FindControl("RadTextBoxDiscountEndDate"), RadTextBox).Text
1026.                    ' check dates
1027.                    If myStartDate < myCurrentDateTime And myEndDate > myCurrentDateTime Then
1028.                        ' default get the discounted price
1029.                        myAmount = TryCast(e.ListViewItem.FindControl("RadTextBoxDiscountedPrice"), RadTextBox).Text
1030.                        If myAmount = 0 Then
1031.                            ' get the percentage - no discounted price used
1032.                            myAmount = TryCast(e.ListViewItem.FindControl("RadTextBoxDiscountedPct"), RadTextBox).Text
1033.                            myAmount = (myListPrice * myAmount) / 100
1034.                        End If
1035.                        myRadTextBox = TryCast(e.ListViewItem.FindControl("RadTextBoxDiscountedPrice"), RadTextBox)
1036.                        ' set the discounted price
1037.                        myListPrice = myAmount
1038.                    End If
1039.                End If
1040. 
1041. 
1042.                'ViewState.Add("ID", myDataTable.Rows.Count)
1043.                ViewState.Add("StoreItemId", myStoreItemId)
1044.                ViewState.Add("Name", myName)
1045.                ViewState.Add("Description", myDescription)
1046.                ViewState.Add("SKU", mySKU)
1047.                ViewState.Add("Price", myListPrice)
1048.                ViewState.Add("Quantity", myQuantity)
1049.                ViewState.Add("TotalPrice", Format(myQuantity * myListPrice, "#,##0.00"))
1050. 
1051.                ' get the entry to put it in
1052.                Dim myDataTable As New DataTable("ShopCartDT")
1053. 
1054.                myDataTable = Session.Item("ShopCartDT")
1055. 
1056.                Dim myDataRow As DataRow = myDataTable.Rows.Add()
1057. 
1058.                myDataRow("ID") = myDataTable.Rows.Count
1059.                myDataRow("StoreItemId") = myStoreItemId
1060.                myDataRow("MemberId") = Session.Item("cur_MemberId")
1061.                myDataRow("Name") = myName
1062.                myDataRow("Description") = myDescription
1063.                myDataRow("SKU") = mySKU
1064.                myDataRow("Price") = myListPrice
1065.                myDataRow("Quantity") = myQuantity
1066.                myDataRow("TotalPrice") = Format(myQuantity * myListPrice, "#,##0.00")
1067. 
1068.                ' write it back out
1069.                Session.Item("ShopCartDT") = myDataTable
1070. 
1071.                Me.RadWindowManager1.RadAlert(String.Concat("Item <b>", myName, "</b> has been added to your shopping cart."), 400, 125, "Shop Cart Updated", String.Empty, ImageInfo)
1072. 
1073. 
1074.            End If
1075.        End If
1076. 
1077.    End Sub
1078. 
1079. 
1080.    
1081.End Class


Thanks






0
SDI
Top achievements
Rank 1
answered on 23 Mar 2015, 02:41 PM
maybe this will help shed some light on it
 
When the page loads there are no errors. the images and their thumbnails show appropriately for each item in the radlsitview. if i
click on a thumbnail the lightbox pops up and ajax runs, note this is the first time clicking. if there are multiple thumbnails or just one, it shows up fine.it shows the Ajax running in the lightbox. BUT if i dont click on the firstimage in the thumbnail list, say there are 4 and i click on number 2, no ajax is fired. The lightbox shows 1 of 4, then it suddenly switches to 2 of 4 and
displays the image. now again this is the first time even clicking an any thumbnail on any of the radlistview item gallery thumbnails. after the first time clicking on any thumbnail it will pop up with the "fake" directory error. This happens in the ligtbox pop navigation
and if i click on the thumbnail in the gallery. It loads the image fine, but why is it looking for a file in the "fake" directory.

we need to get this store out there soon, i am not sure if this error will pop up on the site, this is all happening in the environment right now. as you can see from the previous post the code is still in the testing stages.





0
Angel Petrov
Telerik team
answered on 26 Mar 2015, 08:08 AM
Hello,

I have carefully examined the provided code but was not able to pin-point the culprit behind this behavior. As I mentioned it would be hard to tell what exactly triggers the problem without replicating it locally. Having that in mind I would kindly like to ask you to try and assemble a small runnable sample which we can debug.

Additionally if the application uses an older version of the controls please upgrade to the latest and test it again.

Regards,
Angel Petrov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Jamie Hassall
Top achievements
Rank 1
answered on 02 Apr 2015, 01:16 PM
I also get this "fake" issue. Happens when scrolling through the popped up lightbox. Lightbox also closes itself when it happens.

Chrome console
fake:1 GET http://localhost:88/Content/fake 404 (Not Found)
fake:1 GET http://localhost:88/Content/fake 404 (Not Found)
fake:1 GET http://localhost:88/Content/fake 404 (Not Found)
fake:1 GET http://localhost:88/Content/fake 404 (Not Found)
fake:1 GET http://localhost:88/Content/fake 404 (Not Found)


         <telerik:RadImageGallery ID="radGallery" runat="server" DisplayAreaMode="LightBox"  RenderMode="Lightweight" Width="100px"
             OnNeedDataSource="radGallery_NeedDataSource" />
 
 
Protected Sub radGallery_NeedDataSource(sender As Object, e As ImageGalleryNeedDataSourceEventArgs)
    Using db As New ReactOnlineDB
 
        Dim images = (From img In db.CandidateImage Where Not img.Image Is Nothing).ToList()
 
        radGallery.DataImageField = "Image"
        radGallery.DataSource = images
 
    End Using
End Sub
0
Angel Petrov
Telerik team
answered on 07 Apr 2015, 08:35 AM
Hi Jamie,

I tried reproducing the problem in an isolated sample but was unable to do so. In my case both the gallery using binary data and the one using image URLs was displaying the images correctly.

Could you please examine the attachment and tell us what differs in your case? Additionally if you can modify it in such a manner so that the problem can be replicated that would be great.

Regards,
Angel Petrov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
ImageGallery
Asked by
SDI
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
SDI
Top achievements
Rank 1
Jamie Hassall
Top achievements
Rank 1
Share this question
or