Hi Folks,
Was wondering If i could find some help with this -
I've currently got a SharePoint list, three coloums:
-Directorate
-Department
-Name
I have a Form, with the same three boxes (drop downs)
Id like the form to fill the the data from the one List, depending on what the selection was, so when Directorate changes, Department is populated with the information from the list, and then again when the deparment is selected, to populate Name with the Names under that department.
I can get it working when the i have the Directorate, Department and Names in seperate lists, but cannot seem to get it to work from the one list.
My Code is (VB.net)
Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup
AddHandler EventManager.XmlEvents("/my:myFields/my:Directorate").Changed, AddressOf Directorate_Changed
AddHandler EventManager.XmlEvents("/my:myFields/my:Department").Changed, AddressOf Department_Changed
End Sub
Public Sub Directorate_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)
Call SetDepartment()
End Sub
Private Sub SetDepartment()
Dim q As FileQueryConnection, OriginalFileLocation As String
q = CType(Me.DataConnections("Appraisal Progress List"), FileQueryConnection)
OriginalFileLocation = String.Copy(q.FileLocation)
Try
q.FileLocation = q.FileLocation + "&FilterField1=Department&FilterValue1=" + GetDepValue()
q.Execute()
Finally
q.FileLocation = OriginalFileLocation
End Try
End Sub
Private Function GetDepValue() As String
Dim nav As XPathNavigator, filterValue As String
nav = Me.CreateNavigator()
filterValue = nav.SelectSingleNode("/my:myFields/my:Department", Me.NamespaceManager).Value
GetDepValue = filterValue
End Function
Public Sub Department_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)
Call SetName()
End Sub
Private Sub SetName()
Dim q As FileQueryConnection, OriginalFileLocation As String
q = CType(Me.DataConnections("Appraisal Progress List"), FileQueryConnection)
OriginalFileLocation = String.Copy(q.FileLocation)
Try
q.FileLocation = q.FileLocation + "&FilterField1=Name&FilterValue1=" + GetNameValue()
q.Execute()
Finally
q.FileLocation = OriginalFileLocation
End Try
End Sub
Private Function GetNameValue() As String
Dim nav As XPathNavigator, filterValue As String
nav = Me.CreateNavigator()
filterValue = nav.SelectSingleNode("/my:myFields/my:Name", Me.NamespaceManager).Value GetNameValue = filterValue End Function
Any ideas where I'm going wrong with this?
Many thanks in Advance.
Irianna