help for atlas: cascading drop down from database?
-
Hello, making progress in trying to get atlas working...But not quite there yet... To populate the dropdownlists from a database: Public Function populateProjectDDL() Dim knownCategoryValues As String Dim category As String (...) (Filled my dataset called ds1.) For Each datarowitem As DataRow In ds1.Tables(0).Rows ?!?!?!?! Next return ?!?!?! end function What do I return, how do i fill the whatever i return? (http://atlas.asp.net/atlastoolkit/Walkthrough/CCDWithDB.aspx[^] was trying to follow that example but they lost me in the c++) Please help me? (asp.net forum mods won't let my posts appear)
-
Hello, making progress in trying to get atlas working...But not quite there yet... To populate the dropdownlists from a database: Public Function populateProjectDDL() Dim knownCategoryValues As String Dim category As String (...) (Filled my dataset called ds1.) For Each datarowitem As DataRow In ds1.Tables(0).Rows ?!?!?!?! Next return ?!?!?! end function What do I return, how do i fill the whatever i return? (http://atlas.asp.net/atlastoolkit/Walkthrough/CCDWithDB.aspx[^] was trying to follow that example but they lost me in the c++) Please help me? (asp.net forum mods won't let my posts appear)
Made progress...: _ Public Function populateProjectDDL(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue() 'Dim knownCategoryValues As String 'Dim category As String 'Which projects to show: If Session("admin") = 1 Then ds1 = dbComponent1.selectOneCondition("Project", "active", 1) 'info1.InnerText = "As admin, you see inactive projects, wells, sections and Drilling units as well." Else Dim querystr = "SELECT DISTINCT P.project_id, P.project_name FROM Project as P, UserRole as UR WHERE " querystr = querystr + "UR.user_id = " & Session("active_user") & " AND " querystr = querystr + "UR.project_id = P.project_id AND " querystr = querystr + "P.active = 1" ds1 = dbComponent1.query(querystr) End If Dim objTable As System.Data.DataTable objTable = ds1.Tables(0) If ds1.Tables(0).Rows.Count > 0 Then 'user cannot set defaults With objTable Dim intRow As Integer Dim values As List(Of CascadingDropDownNameValue) = New List(Of CascadingDropDownNameValue) For intRow = 0 To .Rows.Count - 1 values.Add(New CascadingDropDownNameValue(.Rows(intRow).Item("project_name").ToString, .Rows(intRow).Item("project_id"))) Next Return values.ToArray End With Return New CascadingDropDownNameValue() {} 'Return knownCategoryValues 'Return category Else Return Nothing End If ds1.Clear() End Function Now [method error 500] in the project drop down...
-
Made progress...: _ Public Function populateProjectDDL(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue() 'Dim knownCategoryValues As String 'Dim category As String 'Which projects to show: If Session("admin") = 1 Then ds1 = dbComponent1.selectOneCondition("Project", "active", 1) 'info1.InnerText = "As admin, you see inactive projects, wells, sections and Drilling units as well." Else Dim querystr = "SELECT DISTINCT P.project_id, P.project_name FROM Project as P, UserRole as UR WHERE " querystr = querystr + "UR.user_id = " & Session("active_user") & " AND " querystr = querystr + "UR.project_id = P.project_id AND " querystr = querystr + "P.active = 1" ds1 = dbComponent1.query(querystr) End If Dim objTable As System.Data.DataTable objTable = ds1.Tables(0) If ds1.Tables(0).Rows.Count > 0 Then 'user cannot set defaults With objTable Dim intRow As Integer Dim values As List(Of CascadingDropDownNameValue) = New List(Of CascadingDropDownNameValue) For intRow = 0 To .Rows.Count - 1 values.Add(New CascadingDropDownNameValue(.Rows(intRow).Item("project_name").ToString, .Rows(intRow).Item("project_id"))) Next Return values.ToArray End With Return New CascadingDropDownNameValue() {} 'Return knownCategoryValues 'Return category Else Return Nothing End If ds1.Clear() End Function Now [method error 500] in the project drop down...
Solved: Solution: include the populate of first drop down in aspx page, don't specify a servicepath for the first one, like this: <WebMethod()> _ Public Function populateProjectDDLPageMethod(ByVal knownCategoryValues As String, ByVal category As String) As AtlasControlToolkit.CascadingDropDownNameValue() (...) </x-turndown>