Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Default edit mode problem

Reply
Thread Tools

Default edit mode problem

 
 
Chris
Guest
Posts: n/a
 
      05-29-2006
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.


 
Reply With Quote
 
 
 
 
CaffieneRush@gmail.com
Guest
Posts: n/a
 
      05-30-2006
Where are you calling this code from? Page_Load?

It will be safest to call the code above from within the ItemCreated
event handler of the FormView. This way you know that the controls
within the row (HeaderRow, FooterRow, BottomPagerRow) has created.

Regards,
Andy

 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      05-30-2006
It is getting called from the itemcreated. That's what is confusing me. The
control should have been added.

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Where are you calling this code from? Page_Load?
>
> It will be safest to call the code above from within the ItemCreated
> event handler of the FormView. This way you know that the controls
> within the row (HeaderRow, FooterRow, BottomPagerRow) has created.
>
> Regards,
> Andy
>



 
Reply With Quote
 
CaffieneRush@gmail.com
Guest
Posts: n/a
 
      05-30-2006
Very strange, it's almost as if the FormView is not loading the
EditItemTemplate properly when you set the DefaultMode to Edit.

Regards,
Andy

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formview dropdownlist won't populate in insert mode, but does in edit mode ??? jobs at webdos ASP .Net Web Controls 0 10-09-2006 03:38 PM
GridView control enters edit mode when I click Edit link twice Jaime Stuardo ASP .Net Web Controls 0 04-07-2006 12:47 AM
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
Snapshot restraint - edit, edit, edit Patrick Digital Photography 0 05-06-2005 10:53 PM
Would like to load a datagrid already in edit mode instead of having the user click the edit button Frank Kurka ASP .Net Datagrid Control 8 04-29-2005 09:33 AM



Advertisments