Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 27th, 2006, 11:07 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Why is Findcontrol Failing on a Repeater Postback?

I got a page that displays records with a repeater

inside the repeater item records i have controls that get modified with the findcontrol method and they work fine when the page first loads. However, on postback the findcontrol method fails. When debugging the postback I noticed the The repeater itemcreated event is the first thing to happen. Whis is doing this without calling the datareader first?



 
Old January 27th, 2006, 11:29 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

On every page hit, the controls have to be created. Initially, the repeater has no internal data so it doesn't do anything. Once you have databound some data to it, it can create its repeating items. On a postback page hit, the repeater rebuild itself at the beginning of the page lifecycle. When it does this, it raises the ItemCreated event for each item. When you bind to the control, it also raises the ItemDataBound event for each item (ItemCreated first, then ItemDataBound).

-Peter
 
Old January 27th, 2006, 02:21 PM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

so what exactly needs to be added to my code?


 
Old January 27th, 2006, 09:46 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Post the relevant code so we can see what might be happening.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
FindControl in DataListItem SKhna ASP.NET 2.0 Basics 1 February 29th, 2008 05:15 PM
FindControl in nested repeater chrisk_47 .NET Framework 2.0 0 February 6th, 2007 10:45 PM
FindControl Wervis C# 7 November 30th, 2005 09:51 AM
FindControl dkr72 Excel VBA 0 January 19th, 2005 09:55 AM
Problem with FindControl RussC Excel VBA 1 June 16th, 2004 11:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.