bind data both ways in a repeater control

G

Guest

Hi;

I have a Repeater control where in my code-behind I call:
rptrProducts.DataSource = cart.CartItems;
rptrProducts.DataBind();

And then in the aspx file I have:
<asp:TextBox ID="txtQuantity" Text='<%# Eval("Quantity") %>' runat="server"
Columns="3" />

Which does a great job of getting the quantity into the text box. Is there a
way to have it also get the value the user enters back into
cart.CartItems[ind].Quantity? I can write code to do that - but having it
happen automatically would be better.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
W

Walter Wang [MSFT]

Dave,

In the whole ASP.NET 2.0 control toolbox, only three controls support
two-way binding -- GridView, FormView, and DetailsView. Two-way data
binding requires additional logic in the control code to invoke proper
methods on the bound data source, which has to be a data source control.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Walter Wang [MSFT]

Putting a Repeater inside a FormView, you will still need to bind the
Repeater to some data source, therefore it's still the Repeater instead of
the FormView that is interacting with the data source.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top