Apr 05, 2009, 10:43 AM
[FIXED] Microsoft ScriptManager and Date Format
Hello,
The following example demonstrates an inconsistency between the Microsoft ASP.NET ScriptManager and the scripts it automatically loads, and the ExtJS Date.format function.
Check out the following simplified example, this one took me a couple hours to track:
1. Load page
2. Notice the format is incorrect?
3. Remove <asp:ScriptManager runat="server" />
4. Reload page
5. Corrected
The Date.format function only works as expected when a Microsoft ASP.NET ScriptManager is not loaded on the page.
Cheers,
Timothy
The following example demonstrates an inconsistency between the Microsoft ASP.NET ScriptManager and the scripts it automatically loads, and the ExtJS Date.format function.
Check out the following simplified example, this one took me a couple hours to track:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Coolite.Ext.Web.ScriptManager.GetCurrent(Page).RegisterAfterClientInitScript("getStartDate()");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function getStartDate() {
var startDate = Date.parseDate('2009-01-01T00:00:00', 'Y-m-dTh:i:s');
var format = 'l M. jS, Y';
alert(startDate.format(format));
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" />
<ext:ScriptManager runat="server" />
</form>
</body>
</html>
Replication steps:1. Load page
2. Notice the format is incorrect?
3. Remove <asp:ScriptManager runat="server" />
4. Reload page
5. Corrected
The Date.format function only works as expected when a Microsoft ASP.NET ScriptManager is not loaded on the page.
Cheers,
Timothy