Formview objectdatasource not updating

"When using a business object with the Object Data Source control, culture information seems to be ignored when property values are extracted from the Text Box control generated by a Bound Field.

The same is true when a Template Field is used." from here. I encountered this problem when I was working on a page using Form View and Object Data Source to grab some values including a date value into the database.

The secret is the Form View Generator - which many of you have used before but may not have thought about it in this way.

Here is Microsoft’s description for the Form View Control: control is used to display a single record from a data source in a table.

In this posting I will show you how to use strongly typed Form View to save data that user modified.

Update mechanism for strongly typed controls is similar to select one.

Think about it, most forms start off by placing controls on the design surface and laying them out in tables, and naming the controls, and remembering what fields are in the database, and, and, and. But by using the Form View control, you can have Microsoft auto-generate most of these lines by reading the database table and creating the start of the form.

It is already using Templates (which are the absolute secret of good forms) and then you can modify the auto-generated code to your liking.

Because this is meant to be a quick example I don’t want to spend a lot of time helping the reader get the database set up, so I’m using the built-in ASPNETDB. To do approach #2, go to the Data Set, click on the Table Adapter and select F4 to open its Properties dialog.

Before running solution put breakpoint to closing brace like shown on next screenshot. If there is no errors you should see form like this. When Visual Studio hits breakpoint take a look at product that is given to Update Product() method.

I changed Heineken to Heineken Lager and price from 0.88 to 0.8.

The Form View control is often used in combination with a . NET that it makes my head spin, but I am always looking for easier ways to cut down on the time it takes to produce even the simplest form.

Well I think I have found the best and easiest method of getting my form development started- and I didn’t have to write any code! In a small form, this can mean more than a thousand lines of markup of HTML and the like.

Leave a Reply