Link to home
Start Free TrialLog in
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?
Avatar of plusone3055
plusone3055
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of JessyEzzy
JessyEzzy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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