WorkerBeeJ
Programmer
I have an aspropDownList contained in an asp:table and I'm trying to populate it with items contained in a dataset. Here's the control:
<asp:TableCell Wrap="False"><aspropDownList id="lstBusinessUnit" runat="server" DataValueField="BusinessUnitID" DataTextField="BusinessUnitInfo" Width="100" ></aspropDownList></asp:TableCell>
And here's the codebehind where I'm trying to populate the DropDownList:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CheckValidSession()
Dim dsBusinessUnits As DataSet
With New BusinessUnitBus()
dsBusinessUnits = .GetActiveBusinessUnits()
End With
lstBusinessUnits.DataSource = dsBusinessUnits '**line 31
lstBusinessUnits.DataBind()
End Sub
I'm getting a NullReferenceException on line 31. Can anyone tell me where I'm going wrong? (Or let me know what else I should post?)
thanks!
<asp:TableCell Wrap="False"><aspropDownList id="lstBusinessUnit" runat="server" DataValueField="BusinessUnitID" DataTextField="BusinessUnitInfo" Width="100" ></aspropDownList></asp:TableCell>
And here's the codebehind where I'm trying to populate the DropDownList:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CheckValidSession()
Dim dsBusinessUnits As DataSet
With New BusinessUnitBus()
dsBusinessUnits = .GetActiveBusinessUnits()
End With
lstBusinessUnits.DataSource = dsBusinessUnits '**line 31
lstBusinessUnits.DataBind()
End Sub
I'm getting a NullReferenceException on line 31. Can anyone tell me where I'm going wrong? (Or let me know what else I should post?)
thanks!