473,725 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:Litera l id="litID" runat="server" />
<br><asp:TextBo x 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_Ite mDataBound"
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:txtQuant ity 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 3917
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:Litera l id="litID" runat="server" />
<br><asp:TextBo x 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_Ite mDataBound"
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:txtQuant ity 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
4279
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 which is related to the repeater. In the code shown below, if I call Repeater1.Controls.Count in the OnInit (the code fragment was highlighted in yellow) , the viewstate for the repeater will be lost during the postback. You can re-produce this...
0
1417
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 he clicks again, after postback, the ItemCommand is raised like it is supposed to do. This behavior is reproducible.
4
8999
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"> <ItemTemplate> <asp:Label ID="ClassLabel" Runat="server"> <... various other ASP.NET Web Controls ...> </ItemTemplate> </asp:repeater>
0
1795
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 for another repeater in page. (So I have a repeater and a Usercontrol that contains repeater)
2
3479
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 RepeaterItemEventArgs.Item.DataItem. Does anybody know more about this strange behaviour? Thanks Philippe
1
17044
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 control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
2
4829
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
2699
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 to the viewstate, but does anyone know what would cause those DropDownList objects to clear out on postback. Is there a setting on the Repeater I am forgetting about? I tried tooling with EnableViewState but that did not work. The Repeater gets...
0
1076
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 not shown. This is done using a placeholder which either gets a </bror string.empty. This works fine. Now in the repeater there is a button which will cause the file selected to play. I use Javascript for this which works fine. I also have a...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9179
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
9116
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
8099
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
6011
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
4519
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
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.