I would think this code should be very simple and straight forward but I'm having issues. The sub below is called on the page load. It is nestled between similar functions that load other drop down lists. All the rest of the drop downs are populating but these are not. The other drop downs subs use the same With clause but are binding to a DataSet (of one table) that is populated with a stored procedure call to the database rather than binding to a static DataTable.
VB Code:
Private Sub LoadEquations()
Dim dtMain As DataTable
Dim dtGypsum As DataTable
Dim dr As DataRow
dtMain.Columns.Add("Text")
dtMain.Columns.Add("Value")
dr = dtMain.NewRow
dr.Item("Text") = " "
dr.Item("Value") = "0"
dtMain.Rows.Add(dr)
dtMain.AcceptChanges()
dr = dtMain.NewRow
dr.Item("Text") = "Build"
dr.Item("Value") = "B"
dtMain.Rows.Add(dr)
dtMain.AcceptChanges()
dr = dtMain.NewRow
dr.Item("Text") = "Maintain"
dr.Item("Value") = "M"
dtMain.Rows.Add(dr)
dtMain.AcceptChanges()
With Me.ddMainEquation
.DataSource = dtMain
.DataTextField = "Text"
.DataValueField = "Value"
.DataBind()
End With
dtGypsum.Columns.Add("Text")
dtGypsum.Columns.Add("Value")
dr = dtGypsum.NewRow
dr.Item("Text") = " "
dr.Item("Value") = "0"
dtGypsum.Rows.Add(dr)
dtGypsum.AcceptChanges()
dr = dtGypsum.NewRow
dr.Item("Text") = "pH Base"
dr.Item("Value") = "P"
dtGypsum.Rows.Add(dr)
dtGypsum.AcceptChanges()
dr = dtGypsum.NewRow
dr.Item("Text") = "% Sodium Base"
dr.Item("Value") = "S"
dtGypsum.Rows.Add(dr)
dtGypsum.AcceptChanges()
With Me.ddGypsumEquation
.DataSource = dtGypsum
.DataTextField = "Text"
.DataValueField = "Value"
.DataBind()
End With
End Sub
DNN / ASP Code:
<tr>
<td>
<asp:Label ID="lblMainEquation" runat="server"
CssClass="FormLabelLeft">Main Equation</asp:Label></td>
<td>
<asp:Label ID="lblGypsumEquation" runat="server"
CssClass="FormLabelLeft">Gypsum Equation</asp:Label></td>
</tr>
<tr>
<td>
<asp:DropDownList ID="ddMainEquation" TabIndex="34"
runat="server" CssClass="FormField"></asp:DropDownList></td>
<td>
<asp:DropDownList ID="ddGypsumEquation" TabIndex="34"
runat="server" CssClass="FormField"></asp:DropDownList></td>
</tr>
What am I missing? I am using an older DNN platform 2.0.