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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
See http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.editindex.aspx
http://stackoverflow.com/questions/1001548/c-how-to-access-a-dropdownbox-in-a-listview