Cart in a data control

5 views
Skip to first unread message

ZaR

unread,
Nov 6, 2008, 10:36:44 AM11/6/08
to Open Shopping Cart
Hello

I'd like to use AddToCartButtons in a data control (a ListView here).
So, I need to bind AddToCartButton's attributes with data.

Here is an example :

<CART:AddToCartButton ID="AddToCartButton" runat="server"
Text="Order"
PublicPrice='<%# Eval("Price") %>'
{... other things}
UnitSale="1"
Quantity="1"
Reduce="0"
TaxRate="0.0"></CART:AddToCartButton>

and i get an InvalidCastException :(

Any idea ?

Thx :)

ZaR

unread,
Nov 6, 2008, 10:55:56 AM11/6/08
to Open Shopping Cart
sorry.. pb solved :

PublicPrice='<%# Convert.ToDecimal(Eval("Price")) %>'


:)

Marc Chouteau

unread,
Nov 6, 2008, 11:11:44 AM11/6/08
to open-shop...@googlegroups.com
Hi,
 

Verify culture used on the server, b

ecause with that, the conversion of a decimal will be with a point or a comma.

See TaxRate="0.0" or PublicPrice

Marc


2008/11/6 ZaR <cesar.o...@gmail.com>

ZaR

unread,
Nov 7, 2008, 5:14:19 AM11/7/08
to Open Shopping Cart
Hello

Thanks for the tip.
If I face the pb later, I'll think of the culture setting ;)

Another question... (maybe I should start a new discussion.. true. and
yes, these days, I'm enjoying and testing OpenShoppingCart :) !)

In a standard "cart" webpage, which basically contains the
<CART:cartgrid />, I want to implement business logic upon it.
I the Page_Load method, I want to compare Cart.FreeTaxAmount with
smthing and adapt the display.
I've noticed that the Cart.FreeTaxAmount is only refreshed after a
"2nd" postback when I change the products' quantities and call for a
recalc (checked in debug mode in the C# code-behind after a 1st click
and a 2nd click on "Recalc").

What do u think? Is it normal?

Thx.

(merci pour le boulot et la réactivité ici :) )

On 6 nov, 17:11, "Marc Chouteau" <chout...@gmail.com> wrote:
> Hi,
>
> Verify culture used on the server, because with that, the conversion of a
> decimal will be with a point or a comma.
>
> See TaxRate="0.0" or PublicPrice
>
> Marc
>
> 2008/11/6 ZaR <cesar.outre...@gmail.com>
>
>
>
>
>
> > Hello
>
> > I'd like to use AddToCartButtons in a data control (a ListView here).
> > So, I need to bind AddToCartButton's attributes with data.
>
> > Here is an example :
>
> > <CART:AddToCartButton ID="AddToCartButton" runat="server"
> >  Text="Order"
> >  PublicPrice='<%# Eval("Price") %>'
> >  {... other things}
> >  UnitSale="1"
> >  Quantity="1"
> >  Reduce="0"
> >  TaxRate="0.0"></CART:AddToCartButton>
>
> > and i get an InvalidCastException :(
>
> > Any idea ?
>
> > Thx :)- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

Marc Chouteau

unread,
Nov 8, 2008, 5:14:55 AM11/8/08
to open-shop...@googlegroups.com
Hi !
 
Merci pour vos encouragements ;)
 
I moved the project on Google Code to the following address:
 
 
the value of FreeTaxAmount it should be read during the event OnPreRender because the onload event occurs before reading the postback
 
Marc

Reply all
Reply to author
Forward
0 new messages