|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
FormView DataBinding in Insert modeI'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 Hi Anders,
I have the same problem as you had. I would like to know your answers if you have had figured it out. If not, can you tell me how you change the current mode of the formview from insert to edit??? Thanks. Anders Skoglund wrote: Show quoteHide quote > *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 * -- mwangtx ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------
getting Membership userid to use and store in a custom database
Error in DataList test query - aspnet 2.0 Gridview Updates not writing to database after clicking update Dynamically Adding DataLists Custom DropDownList Control and ListItem Hyperlink Control Sorting only certain columns in datagrid Enter Key posts the Page GridView DataFormatString not formatting Custom Control Design Mode |
|||||||||||||||||||||||