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
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