Hi Ken,
I've done some test and it seems it's working on my side when you use:
<asp:Paramete r Name="lastUpdat ed" Type="DateTime" DefaultValue="2 007/12/24"
/>
Here's my test steps:
1) Create a SQLExpress database in VS2005, add a table with three fields:
id, code, lastUpdated.
2) Add a FormView and SqlDataSource to use the table:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FormView ID="FormView1" runat="server" DataKeyNames="i d"
DataSourceID="S qlDataSource1">
<EditItemTempla te>
id:
<asp:Label ID="idLabel1" runat="server" Text='<%#
Eval("id") %>'></asp:Label><br />
code:
<asp:TextBox ID="codeTextBox " runat="server" Text='<%#
Bind("code") %>'>
</asp:TextBox><br />
lastUpdated:
<asp:TextBox ID="lastUpdated TextBox" runat="server"
Text='<%# Bind("lastUpdat ed") %>'>
</asp:TextBox><br />
<asp:LinkButt on ID="UpdateButto n" runat="server"
CausesValidatio n="True" CommandName="Up date"
Text="Update">
</asp:LinkButton>
<asp:LinkButt on ID="UpdateCance lButton" runat="server"
CausesValidatio n="False" CommandName="Ca ncel"
Text="Cancel">
</asp:LinkButton>
</EditItemTemplat e>
<InsertItemTemp late>
id:
<asp:TextBox ID="idTextBox" runat="server" Text='<%#
Bind("id") %>'>
</asp:TextBox><br />
code:
<asp:TextBox ID="codeTextBox " runat="server" Text='<%#
Bind("code") %>'>
</asp:TextBox><br />
lastUpdated:
<asp:TextBox ID="lastUpdated TextBox" runat="server"
Text='<%# Bind("lastUpdat ed") %>'>
</asp:TextBox><br />
<asp:LinkButt on ID="InsertButto n" runat="server"
CausesValidatio n="True" CommandName="In sert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButt on ID="InsertCance lButton" runat="server"
CausesValidatio n="False" CommandName="Ca ncel"
Text="Cancel">
</asp:LinkButton>
</InsertItemTempl ate>
<ItemTemplate >
id:
<asp:Label ID="idLabel" runat="server" Text='<%# Eval("id")
%>'></asp:Label><br />
code:
<asp:Label ID="codeLabel" runat="server" Text='<%#
Bind("code") %>'></asp:Label><br />
lastUpdated:
<asp:Label ID="lastUpdated Label" runat="server" Text='<%#
Bind("lastUpdat ed") %>'>
</asp:Label><br />
<asp:LinkButt on ID="link1" runat="server" CommandName="Ne w"
Text="New"></asp:LinkButton>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
SelectCommand=" SELECT [id], [code], [lastUpdated] FROM [Table1]"
InsertCommand=" Insert into Table1(id,code, lastUpdated)
values(@id,@cod e,@lastUpdated) "
>
<InsertParamete rs>
<asp:Paramete r Name="id" Type="int32" />
<asp:Paramete r Name="code" Type="String"
DefaultValue="d efault code" />
<asp:Paramete r Name="lastUpdat ed" Type="DateTime"
DefaultValue="2 007/12/24" />
</InsertParameter s>
</asp:SqlDataSour ce>
</div>
</form>
</body>
</html>
I think the date parameter's DefaultValue string is parsed using the
current culture of the webform when it's executed, which means this will
depend on the user's browser setting if you're using auto culture for the
webform.
Let me know if this simple test works on your side.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support
=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.