Avatar of OTM
OTM

asked on 

accessing controls in listview on page_load

Hi,

I'm having trouble using the findcontrol method to modify listview content on page_load. What i need to do is populate a listbox programmatically. I know the reason is because i can't modify a listview that hasnt been created yet.

I get the error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

the index is -1, but there must be a way to access a nested control on page_load or without the user having to click something right?
C#ASP.NET

Avatar of undefined
Last Comment
OTM
Avatar of plusone3055
plusone3055
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of JessyEzzy
JessyEzzy

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of OTM
OTM

ASKER

Thanks, this pointed me in the right direction. The other reason the objects werent found was because they weren't found was because they werent actually created under the current edit mode.

See http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.editindex.aspx
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo