I am using Visual Studio 2005 to build a website using ASP.NET and VB.NET. It is accessing data on SQL Server 2005.
I have a form (actually it is in a wizard) that needs data populated from a sqldatareader.
This all works for the first two steps in the wizard, but doesn't populate all of the fields for the third. In fact, the only fields it doesn't populate are the dropdownlists.
Here is a sample of what I'm having it do on page load:
Dim AddSystemOS As DropDownList = AddSystem.ContentTemplateContainer.FindControl("ddlOS")
Dim AddProblemTicketCreatedBy As DropDownList = AddProblem.ContentTemplateContainer.FindControl("ddlTicketCreatedBy")
' This first one works fine, but is on the second step of the wizard If (dtrReader("OS_ID")) Is System.DBNull.Value Then AddSystemOS.SelectedValue = Nothing Else Dim OS As New TextBox OS.Text = dtrReader("OS_ID") AddSystemOS.SelectedValue = OS.Text End If 'This one doesn't work at all, and is on the third step If (dtrReader("OPENEDBY_EMPLOYEE_ID")) Is System.DBNull.Value Then AddProblemTicketCreatedBy.SelectedValue = Nothing Else Dim CreatedBy As New TextBox CreatedBy.Text = dtrReader("OPENEDBY_EMPLOYEE_ID") AddProblemTicketCreatedBy.SelectedValue = CreatedBy.Text End If
I would also like to point out that other controls on the third step are working (checkboxes, and textboxes). It is only the dropdownlists that are not.
Also, something else strage I noticed once I started doing this, the wizard no longer starts on the first step. Instead it starts on the second step.