Default Edit Formview error

C

Chris

I am using the formview control. Within its edit template I have a treeview,
which I populate programatically. Initially I had an item template in which
I had a button, which triggered the edit template. The treeview was
populated with the following code

Protected Sub FormView1_ItemCreated(ByVal sender As Object, ByVal e As
System.EventArgs)
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
End Sub

However when I change the formview's default view to edit I keep getting an
'Object reference not set to an instance of an object' error when I try to
find the treeview. I'm a bit stumped. Can anyone help? Regards, Chris.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top