p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   .NET Framework 2.0 (http://p2p.wrox.com/forumdisplay.php?f=141)
-   -   shopping cart-fly to basket in asp.net (http://p2p.wrox.com/showthread.php?t=64550)

shanthiniGanesh December 13th, 2007 06:33 AM

shopping cart-fly to basket in asp.net
hi all...
i am creating a shopping cart website. i want to implement product added to cart visually shown to user. i search this concept i got one javascript function. but i need to pass dynamic value to that function. my coding is as follows..

function addToBasket(productId){
if(!shopping_cart_div)shopping_cart_div = document.getElementById('shopping_cart');
flyingDiv = document.createElement('DIV');
flyingDiv.style.position = 'absolute';

shopping_cart_x = shoppingCart_getLeftPos(shopping_cart_div);
shopping_cart_y = shoppingCart_getTopPos(shopping_cart_div);

currentProductDiv = document.getElementById('slidingProduct' + productId);currentXPos = shoppingCart_getLeftPos(currentProductDiv);
currentYPos = shoppingCart_getTopPos(currentProductDiv);

diffX = shopping_cart_x - currentXPos;
diffY = shopping_cart_y - currentYPos;

var shoppingContentCopy = currentProductDiv.cloneNode(true);
flyingDiv.innerHTML = '';
flyingDiv.style.left = currentXPos + 'px';
flyingDiv.style.top = currentYPos + 'px';
flyingDiv.style.width = currentProductDiv.offsetWidth + 'px';

this is my asp.net code

<asp:DataList ID="dlstProductDetails" runat="server" RepeatDirection="Horizontal" RepeatColumns="3" HorizontalAlign="Center" style="text-align: center" Width="100%" SkinID="DataList" >
<div id="slidingProduct+dynamicvalue" class="sliding_product"><asp:ImageButton ID="imgbtnProductImage" runat="server" ImageUrl='<%#"images.aspx?id=" + Eval("ProductNo")%>' Height="100" Width="100" Commandname='<%#DataBinder.Eval(Container.DataItem , "ProductNo")%>' OnCommand="Filterdescription"/>
<asp:Label ID="lblProductName" runat ="server" Text ='<%#DataBinder.Eval(Container.DataItem, "Productname")%>'></asp:Label>
<asp:Label ID="lblHyp" runat="server" text=" - " ForeColor="#ff8000"/>
<asp:Label ID="lblModelNo" runat ="server" Text ='<%#DataBinder.Eval(Container.DataItem, "ModelNo")%>'></asp:Label>
<br />
<asp:Label ID="lblrs" runat="server" text="RS." ForeColor="#ff8000"/>
<asp:Label ID="lblPrice" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SalesPrice")%>' ForeColor="#ff8000" ></asp:Label>
<asp:Label ID="Label1" runat ="server" Text ='<%#DataBinder.Eval(Container.DataItem, "ProductNo")%>'></asp:Label>

<br />
<a href="#" onclick="addToBasket(productno);return false;"><img src="images/basket.gif"></a>


just see those functions. i need to pass dynamic value to addtobasket method and div id
 any one have any idea?

samjudson December 18th, 2007 07:31 AM

The code is right there in front of you.

<%#DataBinder.Eval(Container.DataItem, "ProductNo")%>

This will give you the ProductNo for the particular row.

<div id="slidingProduct<%#DataBinder.Eval(Container.Dat aItem, "ProductNo")%>" class="sliding_product">


<a href="#" onclick="addToBasket('<%#DataBinder.Eval(Container .DataItem, "ProductNo")%>'); return false;">

/- Sam Judson : Wrox Technical Editor -/

Meisam.Kimiaei August 1st, 2012 01:35 PM

hi friends
is source code this program?
if it is,sending...[:confused:][:confused:][:confused:]

Meisam.Kimiaei August 1st, 2012 01:36 PM

hi friends
is source code this program?
if it is,sending... [:confused:][:confused:][:confused:]

All times are GMT -4. The time now is 08:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.