How to get the values from ascx control to aspx page?
Posted on 2006-04-14
I'm using Microsoft Visual Studio 2005. I'm trying get values from my user control (ascx) page to aspx (.aspx) page. The values in the user control are the listbox controls, I would like to be able to loop thru the listbox from .aspx page to .ascx controls.
I saw some examples and try to follow the example that was posted, I got the error message of saying: "System.NullReferenceException: Object reference not set to an instance of an object."
What I have do wrong?
Here's my source code:
Protected oProductListCtl As ProductListCtl
Dim cboSelProductList As ListBox
cboSelProductList = oProductListCtl.FindControl("cboSelectedProduct")
(it failed in here:System.NullReferenceException: Object reference not set to an instance of an object.)
For i = 0 To cboSelProductList.Items.Count - 1
sSelValue = sSelValue & cboSelProductList.Items(i).Value & ","
Your help will be greatly appreciated.