473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

bind data both ways in a repeater control

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
Jan 17 '07 #1
3 3178
Well.. i think, the way to write the code is good option.

Niraj Ranka
"David Thielen" <th*****@nospam.nospamwrote in message
news:7B**********************************@microsof t.com...
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


Jan 17 '07 #2
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 (wa****@online.microsoft.com, 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.

Jan 17 '07 #3
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 (wa****@online.microsoft.com, 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.

Jan 18 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: timmso | last post by:
I got this sample of code from Mike Moore in response to my question of how I create clickable links from a data source. <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate>...
3
by: AFN | last post by:
I need to manually create the data to be shown in a datagrid (or some data table object). Should I create an array and bind the array to the datagrid OR should I create a temporary dataset and...
6
by: Zenobia | last post by:
Hello folks, How do I bind an array to a repeater? or bind an array to a hyperlink (which is repeated inside a repeater) ? I get this message: Compiler Error Message: BC30456: 'DataItem'...
1
by: Darrel | last post by:
I use repeater controls and attach a dataset to it to create a list of records. When I want to display just one record, what should I bind the data to? I can use a repeater, but it clutters the...
7
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the...
0
by: Nick | last post by:
Hi, I have a Repeater control and want to bind a hyperlink to each repeated row. For this I can use the following syntax (excuse any incorrect naming but I don't have any code to hand): ...
2
by: sanju | last post by:
Hi, I am struggling to replace a bit value 'True' or 'False' with a image true.gif or false.gif and bind it to a repeater control. I am getting values 'true' or 'false' depending on whether...
0
by: Will Chamberlain | last post by:
Before I start let me clarify that an XmlDataSource will not work for what I am doing. I am attempting to recreate a .NET version of binding Xml Data Islands to HTML Tables in IE 5.x+. You could...
2
by: akshalika | last post by:
Hi, I have a repeater control. it dynamically bind textbox or dropdown base on some condition. i want to bind required field validator dynamically for validate textbox or dropdown. here is my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.