473,398 Members | 2,113 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,398 software developers and data experts.

Why is the repeater empty in a postback?

Hello,

I have a form that contains a repeater. A simplified version of the
ItemTemplate is shown below (air code)...

<br><asp:Literal id="litID" runat="server" />
<br><asp:TextBox id="txtQty" runat="server" />
<hr>

This basically shows a list of item IDs, with quantities for each one.
The quantity is in a text box so the user can change it. I set the Text
properties in the ItemDataBound event.

When the page is posted back, I want to go through the repeater and
update a database based on the info in it. After that, I will bind the
repeater to the database data and have the new info displayed.

The problem is that the repeater does not contain any items on postback.
I tried looping through the Items collection, but it's empty. The tag
for the repeater looks like...

<asp:Repeater ID="rptBasket" OnItemDataBound="rptBasket_ItemDataBound"
RunAt="Server">

so it's not that I've turned off the view state.

The one point that might be relevant here is that the repeater and its
code are inside a user control. Don't know if this makes any difference.

Any ideas? I know the info is there, as if I dump the form contents to
the page, I see form fields with names like
_ctl3:rptBasket:_ctl2:txtQuantity which shows the textbox values are
there. I don't see anything for the literals though.

Please help, I'm really stuck here. TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #1
2 3873
you will have to do a FOR EACH item in the repeater's collection and use the
FindControl() call to capture the textbox to get the value.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Alan Silver" wrote:
Hello,

I have a form that contains a repeater. A simplified version of the
ItemTemplate is shown below (air code)...

<br><asp:Literal id="litID" runat="server" />
<br><asp:TextBox id="txtQty" runat="server" />
<hr>

This basically shows a list of item IDs, with quantities for each one.
The quantity is in a text box so the user can change it. I set the Text
properties in the ItemDataBound event.

When the page is posted back, I want to go through the repeater and
update a database based on the info in it. After that, I will bind the
repeater to the database data and have the new info displayed.

The problem is that the repeater does not contain any items on postback.
I tried looping through the Items collection, but it's empty. The tag
for the repeater looks like...

<asp:Repeater ID="rptBasket" OnItemDataBound="rptBasket_ItemDataBound"
RunAt="Server">

so it's not that I've turned off the view state.

The one point that might be relevant here is that the repeater and its
code are inside a user control. Don't know if this makes any difference.

Any ideas? I know the info is there, as if I dump the form contents to
the page, I see form fields with names like
_ctl3:rptBasket:_ctl2:txtQuantity which shows the textbox values are
there. I don't see anything for the literals though.

Please help, I'm really stuck here. TIA

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #2
>you will have to do a FOR EACH item in the repeater's collection and use the
FindControl() call to capture the textbox to get the value.


That's what I did, but as I explained, the repeater's collection was
empty. I have done this sort of thing many times before without problem,
I just wonder if it was the fact that the repeater was in a user control
that made this different.

Any idea? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #3

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

Similar topics

8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
0
by: Sparhawk | last post by:
I got a weird problem with a repeater. The Repeater has an ImageButton in its ItemTemplate. The Repeater has an ItemCommand defined. If the user clicks one of the buttons, nothing happens. If...
4
by: Harry | last post by:
Hello, I have a Repeater control that contains a Label control inside its ItemTemplate. A dummy mockup of the HTML code looks as follows: <asp:repeater id="StyleRepeater" Runat="server">...
0
by: Amir | last post by:
Hi every one This is the problem: I have a UserControl that contains a Repeater and a few LinkButton. The Repeater generate some linkButton. I use this control for implementing paging solution...
2
by: Philippe Camus | last post by:
I didn't find any documentation about this behaviour. On postbacks the Repeater ItemCreated event is fired before Page_Load event It occurs for each item with empty...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
2
by: Nemo | last post by:
Hi, I have i fishy problem when I have e Repeater with user controls. page_load { if (!isPostBack) { repeater.databind(); }
1
by: Jeremy | last post by:
Hello All, I have a Repeater which contains a Dynamic DropDownList within its itemtemplate. I know I have struggled with this before and I am pretty sure I had to save a bunch of crap manually...
0
by: Lloyd Sheen | last post by:
I have a repeater in which there can be a table cell that has either one or two lines (sep by /br). If the second line would be the same in all occurences of the repeater then the second line is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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,...
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.