Objectdatasource onupdating not firing

Rated 4.96/5 based on 602 customer reviews

The first code example demonstrates how to use a Drop Down List control, Text Box controls, and several Object Data Source objects to update data. Connection Strings("Northwind Connection") Dim conn As New Sql Connection(cts. For more information about parameter merging, object lifetime, and method resolution, see Update Method.

The second code example shows the class that is used in the first code example. Connection String) Dim sc As New Sql Command(" SELECT First Name, Last Name, Address, City, Postal Code " & _ " FROM Employees " & _ " WHERE Employee ID = @emp Id", conn) ' Add the employee ID parameter and set its value. When the Object Data Source control is associated with a data-bound control, such as the Grid View control, it is not necessary to call the Update method from page code.

For more information, see Script Exploits Overview.

Connection String, _ "SELECT Employee ID FROM Employees") Try Dim IDs As IEnumerable = sds. Empty) ' Iterate through the Enumeration and create a ' Northwind Employee object for each ID. To String() Dim nwe As New Northwind Employee(id) ' Add the Northwind Employee object to the collection. Add(nwe) End While Finally ' If anything strange happens, clean up. Dispose() End Try Return al End Function ' Get All Employees Public Shared Function Get Employee(an ID As Object) As Northwind Employee Dim al As Array List = CType(Get All Employees(), Array List) Dim enumerator As IEnumerator = al. Move Next() ' The IEnumerable contains initialized Northwind Employee objects. ID = an ID Dim cts As Connection String Settings = Configuration Manager. The Update method delegates to the Update method of the Object Data Source View that is associated with the Object Data Source control.

What I have done to narrow down the problem: (1) Replace Object Data Source with an equivalent Access Data Source : same problem.

Read() Then ' The IEnumerable contains Data Row View objects. Before the Update operation is performed, the On Updating method is called to raise the Updating event.

But I have written a formview whose bind fields are optionally set to invisible too, but that formview works anyway.

Well I have no time to dig deep now, may be later I will inform you my finding.

However a link button siting right beside the image button with a command of "Update" just like the image button, did infact proceed to the ODS updating. Form view doesn't seem to support image buttons that fire commands, unless there is some magical setting I am missing.

Seems a little strange that the button type would have an impact such as this. I have used image buttons a lot in Grid Views and they work well there. In that case the framework can not locate these fields and the update (and insert) parameters are not filled automatically ...

Leave a Reply