Updating objectdatasource

Rated 4.11/5 based on 535 customer reviews

If you want to do everything manually, I've got an article on my blog that details how to do this for a Grid View, which is very similar to how to do it with a Form View, see Aaron The reason this fails is that Page_Init is fired after Form View1_Init, so Find Control in Form View1_Init returns null when getting a reference to the data source.One option that may simplify all of this is to create a custom data source, derived from Object Data Source, and all of this initialization could be encapsulated there.The matching values indicate that the data has not changed since the time it was read. It seems that if, as it is by default, the Conflict Detection Property is set to Overwrite Changes, no additional *original_* parameters should be added to the Update Method!property, and based additionally on the parameter names that make up the business object method's signature.Note: If you simply clear out the Old Values Parameter Format String property value from the Properties window in the Design view, the property will still exist in the declarative syntax, but be set to an empty string.This, unfortunately, will still result in the same problem discussed above.Therefore, either remove the property altogether from the declarative syntax or, from the Properties window, set the value to the default, ., which means the data source control will overwrite any changes made to a data row between the time the data source control first read data from the row and the time that the row is updated.

updating objectdatasource-18

If the data source control is configured to use the Compare All Values option, however, the control passes the original data in the old Values collections of the Update and Delete methods so that you can write logic to update or delete data only if these values match the values currently in the data storage.For example, a sort expression that identifies the Last Name and First Name columns as the columns to use for sorting would be "Last Name, First Name" for an ascending sort and "Last Name, First Name DESC" for a descending sort. However, you might be working with a business object method that takes one or more parameters typed as a complex or user-defined type.To work with complex or user-defined parameter types, you can use the property.Parameters that get values from a specific object, such as a control, session variable, or the user profile, require you to set additional properties.For example, a business object method, you can include parameters for sorting and paging.

Leave a Reply