Showing posts with label bug. Show all posts
Showing posts with label bug. Show all posts

Monday, March 26, 2012

AJAX Toolkit Calendar - Bug for April month

Hi guys,

I just discovered a little bug in the new Calendar from the AJAX Toolkit.

http://ajax.asp.net/ajaxtoolkit/Calendar/Calendar.aspx

Choose "April" as month, and point your cursor over a day. The day in the popup doesn't match the day of the column.

For instance, if I point my cursor over the 1rst of April 2007, the popup says "Sunday, 01 April 2007" (this is correct) but the day is under the "Mo" column (this is wrong). The same thing happens for April 2008, so maybe it's a bug linked to this month.

Note: I didn't try the calendar in the toolkit, just the web site. Maybe the website uses an old version.

Bye,

Matthieu

I just tried this in IE, FF, Opera, and Safari and it's correct for me in all browsers. What browser are you using?

Hi,

I can confirm that the issue is happening in IE and FF in my case.


Then I suspect it's related to the different culture settings or timezones. Garbin, would it be possible for you to investigate a bit since you know your way around this stuff really well? Thanks!

Hi,

I tried with IE 7 and FF 2.

Yes, good idea. Maybe it's linked to culture settings. If you're interested, mine is fr-CH (and my timezone is GMT + 1).


Hi,

I have same problem ot month april.

I'm using FF2.0


Hi KirilRusev,

which culture are you using?


Hi,

guys, could you try to set the EnableScriptGlobalization attribute on the ScriptManager to "true" and see if it does the trick? In my case it did :)


Hi Garbin,

Yes, it does work if I set this attribute to "true"!

Thanks:-)

Matthieu


EnableScriptGlobalization

=true doesn't do what it is supposed to do. I've enabled it and changed my IE language to French Canadian. It will change the day names but not the month name and the "Today" footer.

Is there a download of .vb sourcecode for the Control ToolKit yet?


Hi,

I see. However, it seems that awork item already exists for this issue, so it will surely be fixed as soon as possible.


I'm using IE with en-US localization; I've discovered another bug: all April months contain only 25th day; the rest of months are OK.

Any idea?


Sorry... 24thSmile

Saturday, March 24, 2012

AJAX Timer bug when it updates a panel containing a single Text Box with the characters "&

The Ajax timer seems to have a problem updating a panel what contains a text box that has the characters "<br>\n". Attached is the source code for a very simple page a single multi-line text box where the timer code-behind just assigns the textbox the string "<br>\n". When run, the second update will cause an 500 error from the server.

This error does not happen when the text is something else, say "Hello World".

I assume that the problem is that the sequence "<br>\n" in the text box causes the timer Java Script to break somehow. Anyone knows oh to solve this problem? I am using Ajax 1.0 and the Visual Studio Development Server.

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox> <asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick"> </asp:Timer> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

The code behind for the time update is:

protected void Timer1_Tick(object sender, EventArgs e) { TextBox1.Text ="<br>\n;"; }

Ivan.

I am sorry, the code for the post got mangled but the editor. The code behind for the time update should be:

public partialclass _Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { }protected void Timer1_Tick(object sender, EventArgs e) { TextBox1.Text = "<br>\n"; }}

Apparently, the string <br> is detected as a potentially harmfull string. One solution is to HTML encode the string. However, I do need to display the string <br> in the text box, not <br>. The user must be able to edit the HTML code that we will use.

Ivan.


Apparently, the string <br> is detected as a potentially harmfull string. One solution is to HTML encode the string. However, I do need to display the string <br> in the text box, not <br>. The user must be able to edit the HTML code that we will use.

Ivan.

Ajax time zone bug

there appears to be a bug in the ajax client code. First, try this in javascript:

var testDate = new Date();

var testDateString = testDate.localeFormat("yyyy-MM-ddTHH:mm:ss.fffffffzzz");

I'm in New York, so the value of testDateString = "2007-10-12T12:10:56.34534+4:00" or something like that.


now try doing this in c#

DateTime testDate = DateTime.Now;

testDateString = testDate.toString("yyyy-MM-ddTHH:mm:ss.fffffffzzz");

in this case, the value of testDateString is equal to something like: "2007-10-12T12:10:56.34534-4:00"

now to see some real fun, add this to the above Javascript:

var messedUpDate = Date.parseLocale(testDateString, "yyyy-MM-ddTHH:mm:ss.fffffffzzz");

you'll find that the messed up date is not equal to the original test date. however in c#

DateTimemessedUpDate = Date.ParseExact(testDateString,"yyyy-MM-ddTHH:mm:ss.fffffffzzz",CultureInfo.CurrentCulture.DateTimeFormat);

will yield a date equivalent to testDate.

Is this a bug? or am I misusing/misunderstanding the localeFormat method?

Hi,

I think parseLocal create a date from a localized date string. I think it works only when you do the followings (it is from the documentation):

Remarks

Use the pareseLocale function to create anobject of type Date from a string. If you provide no custom formats,this function uses theSys.CultureInfo.CurrentCulture property to determine the culture value.

To create a date from a locale-specific string that uses the current culture, set theEnableScriptGlobalization property of theScriptManager control totrue. You must also modify settings in the Web.config file so that theculture attribute of the<globalization> section is set toauto.


I don't think this is a localization problem. As you can see by the results of running my code, all the strings do parse correctly as dates, the problem is that the resulting dates are incorrect.


Ok, I see.

First test:

var testDate = new Date();
var testDateString = testDate.localeFormat("yyyy-MM-ddTHH:mm:ss.fffffffzzz");
window.alert( testDateString ); //2007-10-17T10:11:16.0310310-02:00 <-- good
var messedUpDate = Date.parseLocale(testDateString, "yyyy-MM-ddTHH:mm:ss.fffffffzzz");
window.alert( messedUpDate ); //Wed Oct 17 200714:11:16 GMT+0200 (Central Europe Daylight Time) <-- total wrong!!!

Second test:

var testDate = new Date();
var testDateString = testDate.localeFormat("yyyy-MM-ddTHH:mm:ss.fffffff");
window.alert( testDateString ); //2007-10-17T10:13:32.5155155 <-- good
var messedUpDate = Date.parseLocale(testDateString, "yyyy-MM-ddTHH:mm:ss.fffffff");
window.alert( messedUpDate ); //Wed Oct 17 2007 10:13:32 GMT+0200 (Central Europe Daylight Time) <-- also good

Maybe localFormat and parseLocal don't like time zone formatting?!


The issue on the timezone offset was a bug in the javascript date formatting, and will be fixed in the next release. The reason for the discrepancy between parse and format was that parsing didn't have the same bug.