hi all,
I am developing a server user control that has a DropDownList inside. I want my control to have a property that will expose the value of the DropDownList. Currently I am using the following to do so:
where ddList is the DropDownList inside the User Control.VB Code:
Public Property ControlValue() As Long Get Return ddList.SelectedItem.Value End Get Set(ByVal Value As Long) ddList.SelectedIndex = Value End Set End Property
Unfortunately the above code is not working, when I am trying to retrieve the ControlValue property I get the following error:
System.NullReferenceException: Object reference not set to an instance of an object.
In fact I also tried to use a reference to the ddlist but it still does not work, could anybody please help me on this...




Reply With Quote