WEBSWAPP Silverlight ASP.NET 3.5 ASP.NET 2.0 ASP.NET 1.0
Cascading Lists
ITemplate
DDL in GridView
G/V MultiSelect
Nested GridViews
RegExp
DataGrid Reorder
Events fire twice
Hyperlink Field
TextBox
UpdateParameters
MultiView
TreeView
Demo Incorrect Usage

UpdateParameters Collection Usage

If you have received any of the following error message regarding the ObjectDataSourceView.ConvertType:

  1. When receiving dates from browsers that are set with different culture settings than your server:
    Cannot convert value of parameter 'OrderDate' from 'System.String'
  2. When the user leave a textbox empty when a numeric value was supposed to be entered:
    [FormatException: Input string was not in a correct format.]

Then set the ConvertNullToDBNull property of the DataSource control to true and add an UpdateParameters collection. In this sample I explicity cast the updated values to their appropriate types:

    <UpdateParameters>
            <asp:Parameter Name="OrderDate" Type="DateTime" />
            <asp:Parameter Name="ShipName" Type="String" />
            <asp:Parameter Name="Freight" Type="String" />
            <asp:Parameter Name="OrderID" Type="Int32" />
    </UpdateParameters>
    

click here to view the type casting error of this page without the UpdateParamertes

 Order IDOrder DateFreightShipName
Edit10643 8/25/1997 29.4600Alfreds Futterkiste
Edit10692 10/3/1997 61.0200Alfred's Futterkiste
Edit10702 10/13/1997 23.9400Alfred's Futterkiste
Edit10835 1/15/1998 69.5300Alfred's Futterkiste
Edit10952 3/16/1998 40.4200Alfred's Futterkiste
Edit11011 4/9/1998 1.2100Alfred's Futterkiste

ObjectDataSource Class Documentation

Using Parameters with the ObjectDataSource Control documentation on the MSDN
 

Source code:

Demo source code