kicken18
07-13-2007, 04:29 AM
I think I am just going absolutly crazy, but got some problems, Here is the code
For Each Dr In DSPageData.Tables("All").Rows
PKey = (Dr("PKey"))
'Response.Write(PKey)
TName = (Dr("TName"))
'Response.Write(TName)
DBDataAdapter = New SqlDataAdapter("SELECT " & PKey & " FROM " & TName & "", DBConn)
DBDataAdapter.Fill(DSPageData, "Courses")
Dim dropdown As String = "ddl" & PKey & ".DataSource = DSPageData.Tables('Courses').DefaultView"
Dim databind As String = "ddl" & PKey & ".DataBind()"
....
<asp:DropDownList ID="ddlAOE" Runat="server" DataTextField="AOE" />
<asp:DropDownList ID="ddlCM" runat="server" DataTextField="CM" />
<asp:dropdownlist ID="ddlADC" runat="server" DataTextField="ADC" />
Now, my dropdownlist appear when I run the page, obviouslly, but they are not populated. IF I uncomment my response.write bits near the top, I get back what expect, so my sql is working, but my dad isn't binding to the dropdown lists. I think it has something to do with my databind var's, I am assinging them my value, but maybe I am not calling them? As in a classic sense it would be like
DBDataAdapter = New SqlDataAdapter("SELECT Department FROM TBL_Department", DBConn)
DBDataAdapter.Fill(DSPageData, "Department")
DeptDropDown.DataSource = DSPageData.Tables("Department").DefaultView
DeptDropDown.DataBind()
For Each Dr In DSPageData.Tables("All").Rows
PKey = (Dr("PKey"))
'Response.Write(PKey)
TName = (Dr("TName"))
'Response.Write(TName)
DBDataAdapter = New SqlDataAdapter("SELECT " & PKey & " FROM " & TName & "", DBConn)
DBDataAdapter.Fill(DSPageData, "Courses")
Dim dropdown As String = "ddl" & PKey & ".DataSource = DSPageData.Tables('Courses').DefaultView"
Dim databind As String = "ddl" & PKey & ".DataBind()"
....
<asp:DropDownList ID="ddlAOE" Runat="server" DataTextField="AOE" />
<asp:DropDownList ID="ddlCM" runat="server" DataTextField="CM" />
<asp:dropdownlist ID="ddlADC" runat="server" DataTextField="ADC" />
Now, my dropdownlist appear when I run the page, obviouslly, but they are not populated. IF I uncomment my response.write bits near the top, I get back what expect, so my sql is working, but my dad isn't binding to the dropdown lists. I think it has something to do with my databind var's, I am assinging them my value, but maybe I am not calling them? As in a classic sense it would be like
DBDataAdapter = New SqlDataAdapter("SELECT Department FROM TBL_Department", DBConn)
DBDataAdapter.Fill(DSPageData, "Department")
DeptDropDown.DataSource = DSPageData.Tables("Department").DefaultView
DeptDropDown.DataBind()