C
Chris
I have a treeview in the edit template of my formview but not in the item
templete. It is populated programatically with the code below. When the
default mode is readonly this code works fine. When I set the default to
edit I get a 'Object reference not set to an instance of an object' on the
line that tries to find the control. The Formview becomes active when a row
is selected in a gridview.
If FormView1.CurrentMode = FormViewMode.Edit Or FormView1.CurrentMode =
FormViewMode.Insert Then
Dim tw As TreeView
tw = New TreeView()
tw = FormView1.Row.FindControl("treeview1")
tw.Nodes.Clear()
GetFolders(Server.MapPath(""), tw.Nodes)
End If
When I set it to readonly it goes into readonly mode it works fine. But
there is no treeview in the read only mode. When I select the edit button it
goes into edit mode and finds the treeview. It is only in the default mode.
Can anyone help? Regards, Chris.
templete. It is populated programatically with the code below. When the
default mode is readonly this code works fine. When I set the default to
edit I get a 'Object reference not set to an instance of an object' on the
line that tries to find the control. The Formview becomes active when a row
is selected in a gridview.
If FormView1.CurrentMode = FormViewMode.Edit Or FormView1.CurrentMode =
FormViewMode.Insert Then
Dim tw As TreeView
tw = New TreeView()
tw = FormView1.Row.FindControl("treeview1")
tw.Nodes.Clear()
GetFolders(Server.MapPath(""), tw.Nodes)
End If
When I set it to readonly it goes into readonly mode it works fine. But
there is no treeview in the read only mode. When I select the edit button it
goes into edit mode and finds the treeview. It is only in the default mode.
Can anyone help? Regards, Chris.