protected void Swatches_ItemCommand(Object sender, DataListCommandEventArgs e)
{
if (e.CommandName == "Select")
{
string part = e.CommandArgument.ToString();
foreach (DataListItem parentItem in thumbRotatoralt.Items)
{
Label lblPart = (Label)parentItem.FindControl("lblPart");
Label lblproductcode = (Label)parentItem.FindControl("lblproductcode");
if (lblPart.Text == part)
{
Image img1 = (Image)parentItem.FindControl("img1");
Label lblPrice = (Label)parentItem.FindControl("lblPrice");
DataTable DTColourFetch = new DataTable();
DTColourFetch = LoadColourInfo(part, ColourCode, "GetAllColorSwatchesWithMin");
if (DTColourFetch.Rows.Count > 0)
{
string Image1 = DTColourFetch.Rows[0]["Imagename"].ToString();
lblPrice.Text = FormatePrice(price, presaleprice);
img1.ImageUrl = FormatImageURL(Image1);
string pnames = lblname.Text;
string ProductName = pnames + " " + getfirstcolourname;
lblname.Text = ProductName.Trim();
}
}
}
}
}
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DataList ID="thumbRotatoralt" runat="server" OnItemDataBound="ParentList" OnItemCommand="AddToBasket_ItemCommand">
<ItemTemplate>
<div class="ItemListInnerstyle">
<table>
<tr>
<td colspan="2">
<a class="ItemListlinkUnderline" cssclass="relateditemdescr2pbuttons" href="javascript:void(window.openRadWindow('<%#DataBinder.Eval(Container.DataItem,"Part")%>', '<%=ALTCatID %>'))">
<asp:Label ID="lblname" CssClass="ItemListDescr" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.ModelName") %>' />
</a>
</td>
</tr>
<tr>
<td>
<a class="ItemListlinkUnderline" cssclass="relateditemdescr2pbuttons" href="javascript:void(window.openRadWindow('<%#DataBinder.Eval(Container.DataItem,"Part")%>', '<%=ALTCatID %>'))">
<asp:Image ID="imgwebsite" runat="server" CssClass="ItemListMainImg" BorderWidth="0"
ImageUrl='<%# FormatImageURL(DataBinder.Eval(Container.DataItem, "ImageName").ToString()) %>' />
</a>
<br />
<asp:DataList DataKeyField="Sequence" ID="DLColour" runat="server" RepeatDirection="Horizontal"
OnItemCommand="Swatches_ItemCommand" SelectedItemStyle-BorderColor="Black" SelectedItemStyle-BorderStyle="Solid"
SelectedItemStyle-BorderWidth="2px" CellPadding="2" CellSpacing="2">
<SelectedItemStyle BorderColor="Black" BorderWidth="2px" BorderStyle="Solid"></SelectedItemStyle>
<ItemTemplate>
<asp:ImageButton ID="imgcolourbtn" runat="server" CssClass="ItemListSwatchImg" ImageUrl='<%# RtnValue(DataBinder.Eval(Container.DataItem, "colourcode11").ToString(), DataBinder.Eval(Container.DataItem, "Swatchpart").ToString()) %>'
ToolTip="Click on colour to view items" CommandName="Select" CommandArgument='<%# Eval("part") %>'
BorderWidth="1px" BorderColor="#999999" BorderStyle="Solid" />
</ItemTemplate>
</asp:DataList>
</td>
<td>
<asp:Label ID="lblproductcode" CssClass="ItemListDescr" runat="server" Visible="true"
Text='<%# DataBinder.Eval(Container, "DataItem.Part") %>' />
<br />
<asp:Label ID="lblPrice" CssClass="ItemListPrice" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Price") %>' />
<br />
<asp:TextBox ID="qty" Text="1" runat="server" Width="20px"></asp:TextBox>
<asp:Button ID="btnCart" runat="server" CssClass="pbuttonssmal" Text="Add to Basket"
CommandName="AddItemToBasket" />
<br />
<a class="ItemListlinkUnderline" cssclass="relateditemdescr2pbuttons" href="javascript:void(window.openRadWindow('<%#DataBinder.Eval(Container.DataItem,"Part")%>', '<%=ALTCatID %>'))">
More Details </a>
</td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
</asp:UpdatePanel>
|