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
    
<%@ Page Language="C#" Culture="auto" UICulture="auto" AutoEventWireup="false" %> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainContent"> <h2> UpdateParameters Collection Usage </h2> <p>To see this demo, set your browser->Tools->Internet Options->Languages preference to something other than en-us (English United States). This would cause the date format to display differently than my data server and would cause a type casting error. I have commented out the following section out of the code to cause the error to happen. </p> <pre> &lt;UpdateParameters&gt; &lt;asp:Parameter Name="OrderDate" Type="DateTime" /&gt; &lt;asp:Parameter Name="ShipName" Type="String" /&gt; &lt;asp:Parameter Name="Freight" Type="String" /&gt; &lt;asp:Parameter Name="OrderID" Type="Int32" /&gt; &lt;/UpdateParameters&gt; </pre> <asp:DropDownList ID="ddlCustomers" runat="server" DataSourceID="odsCustomersList" DataTextField="CompanyName" DataValueField="CustomerID" AutoPostBack="true"> </asp:DropDownList> <asp:ObjectDataSource ID="odsCustomersList" runat="server" SelectMethod="Customers" TypeName="WEBSWAPP_BLL.Demos"></asp:ObjectDataSource> <asp:GridView ID="GridView1" runat="server" DataSourceID="odsOrders" AutoGenerateColumns="False" CssClass="GridView1ChildStyle"> <SelectedRowStyle CssClass="Blue" /> <HeaderStyle CssClass="Header" /> <Columns> <asp:CommandField ShowEditButton="True" /> <asp:BoundField DataField="OrderID" HeaderText="Order ID" ReadOnly="true" /> <asp:TemplateField HeaderText="Order Date"> <EditItemTemplate> <asp:TextBox ID="txtOrderDate" runat="server" Text='<%# Bind("OrderDate", "{0:d}") %>' Width="70px"></asp:TextBox> <asp:CompareValidator ID="valComp3" ValueToCompare="01/01/2020" ControlToValidate="txtOrderDate" Operator="LessThan" Type="Date" runat="server" Display="None" ErrorMessage="Invalid Date: A valid date must be before January 01 2020" /> <asp:CompareValidator ID="valComp4" ValueToCompare="01/01/1980" ControlToValidate="txtOrderDate" Operator="GreaterThan" Type="Date" runat="server" Display="None" ErrorMessage="Invalid Date: A valid date must be after January 01 1980" /> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("OrderDate", "{0:d}") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Freight" HeaderText="Freight" SortExpression="Freight" /> <asp:BoundField DataField="ShipName" HeaderText="ShipName" SortExpression="ShipName" /> </Columns> </asp:GridView> <asp:ObjectDataSource ID="odsOrders" runat="server" SelectMethod="OrdersByCustomer" TypeName="WEBSWAPP_BLL.Demos" DataObjectTypeName="WEBSWAPP_BLL.clsOrder" UpdateMethod="UpdateOrder"> <SelectParameters> <asp:ControlParameter ControlID="ddlCustomers" Name="CustomerID" PropertyName="SelectedValue" Type="String" /> </SelectParameters> <%-- Add the update parameters to explicity cast the values in 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> --%> </asp:ObjectDataSource> <asp:Label ID="lblStatus" runat="server"></asp:Label> </asp:Content>