FormView DataBinding in Insert mode

  • Thread starter Anders Skoglund
  • Start date
A

Anders Skoglund

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
 

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,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top