Page 1 of 1
using the updown control from within a repeater
Posted: Mon Mar 16, 2009 2:28 pm
by jmestep
I am trying to use the cb updown control from within a repeater and if I set a default value of 1 for the text value, when I change the value, it changes it on the screen, but that new value is not reflected when the items are added to cart. If I use a plain text box, the quantity gets put in fine. Is there something (easy) I can do to pickup the changed value? I'm finding the control on the add to basket button
short quantity = AlwaysConvert.ToInt16(((UpDownControl)item.FindControl("Quantity")).Text);
Thanks
Re: using the updown control from within a repeater
Posted: Mon Mar 16, 2009 9:11 pm
by AbleMods
If you're using it in a repeater, how are you determining which up-down control to pull the value? I'm presuming since it's in a repeater that more than one up-down control is being rendered on the page....
Re: using the updown control from within a repeater
Posted: Tue Mar 17, 2009 4:17 am
by mazhar
The id will not matter if you look for the control within a single row. In this case you can use the id you specified for control. Check ConLib/Basket control and App_Code/BasketHelper.cs class's SaveBasket method.
Re: using the updown control from within a repeater
Posted: Tue Mar 17, 2009 6:38 am
by jmestep
Thanks, I'll look at it.
Joe- I've got other pieces of data in the repeater that I can access using the ItemDataBound event on the repeater using the FindControl, putting some of them into a hidden field after they are changed. Then I pick them up again on the Add to Basket button.
Re: using the updown control from within a repeater
Posted: Tue Mar 17, 2009 11:54 am
by AbleMods
ItemDataBound() is where you can capture it. Or you could switch to a templated gridview control and use the gridview RowCommand method.
Re: using the updown control from within a repeater
Posted: Tue Mar 17, 2009 12:38 pm
by jmestep
Thanks, Joe. That's where I'm capturing the stuff, but I think something in viewstate is interfering.