473,761 Members | 5,163 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

bind data both ways in a repeater control

Hi;

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

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_windwa rd_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
Jan 17 '07 #1
3 3195
Well.. i think, the way to write the code is good option.

Niraj Ranka
"David Thielen" <th*****@nospam .nospamwrote in message
news:7B******** *************** ***********@mic rosoft.com...
Hi;

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

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_windwa rd_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
1547
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> <asp:HyperLink id="HyperLink1" runat="server" NavigateUrl='<%# "http://localhost/ngrid1/repeater.aspx?a=" & Container.DataItem("au_lname") %>'>'<%# DataBinder.Eval(Container.DataItem, "au_fname")%>'</asp:HyperLink> <br> </ItemTemplate>
3
2327
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 bind that to the datagrid? I have never done either (usually I get a recordset from a stored procedure and bind results directly). I also don't know which is faster. Whichever you suggest, can you give a couple lines of sample code? Thank...
6
6648
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' is
1
1446
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 DESIGN view just for one record. Is there a generally accepted 'best option' for what control to use to bind one record to? -Darrel
7
5487
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 Repeater control, I've placed DropDownLists and CheckBoxes. When the user has updated the information, he/he clicks the submit button which is outside the scope of the Repeater control.
0
1034
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): <asp:Hyperlink id="x" NavigateToUrl='<%# Bind("id", "Page.aspc?id={0}") %> Text="Text"></asp:Hyperlink> This all works find but I'd like to be able to bind 2 data items such
2
1599
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 user is logged in or not(with asp.net membership provider) Getting true or false with this <%# Membership.GetUser(Eval("UserID")).IsOnline % and
0
1135
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 easily use an Xml File as DSO and bind to an HTML table, easy. The reason an XmlDataSource doesn't work is because the Xml file isn't downloaded to the client. For my program to work, I need that since I am doing drag and drop and appending...
2
3919
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 aspx design <asp:Repeater ID="repeaterItemAttribute" runat="server" OnItemDataBound="repeaterItemAttribute_ItemDataBound"> <ItemTemplate> <li> ...
0
10111
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.