FormView DataBinding in Insert mode

Discussion in 'ASP .Net Web Controls' started by Anders Skoglund, Nov 7, 2005.

  1. Hi,

    I'm using the FormView control in combination with an ObjectDataSource
    control to handle insert and update operations. The ObjectDataSource control
    has a DataObjectTypeName defined that stores the information for each field.
    When entering Insert Mode I would like to Bind the FormView control to get
    default values filled in automatically. The problem is that the FormView
    Controls doesn't seem to be Bindable in Insert mode:

    if (frvDetails.CurrentMode == FormViewMode.Insert)
    {
    // Change Select method to Get a special instance of DataObjectTypeName
    ods.SelectMethod = "GetDefaultValues";
    // Remove the SelectParameter, since no key is necessary
    ods.SelectParameters.Clear();
    // Bind the FormView control
    frvDetails.DataBind();
    }

    The ObjectDataSource fetches the record (The Selected event returns an
    Instance of type defined in DataObjectTypeName), but FormView never Binds to
    the returned record. I manually changed the mode of the FormView control to
    Edit, and then it worked as expected. There seems to be no way to make
    DataBinding operations in insert-mode!?

    Thanks in advance,
    Anders
    Anders Skoglund, Nov 7, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jobs at webdos
    Replies:
    0
    Views:
    696
    jobs at webdos
    Oct 9, 2006
  2. jobs
    Replies:
    0
    Views:
    877
  3. Just Me
    Replies:
    1
    Views:
    737
    Just Me
    Apr 17, 2007
  4. =?Utf-8?B?QW5u?=

    Formview template insert to edit mode

    =?Utf-8?B?QW5u?=, Apr 30, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    458
    Jon Paal [MSMD]
    May 1, 2007
  5. jobs at webdos
    Replies:
    0
    Views:
    463
    jobs at webdos
    Oct 9, 2006
Loading...

Share This Page