Showing posts with label format. Show all posts
Showing posts with label format. Show all posts

Wednesday, March 21, 2012

LoadPageStateFromPersistenceMedium and AJAX Beta 2

Anyone else using Load/Save PageFromPesistenceMedium and AJAX Beta 2. In my functions, I'm saving the state in a compressed format to reduce the size of the viewstate as its passed back and forth over the browser. We are talking around 1 MB of viewstate uncompressed here so it's needed...

Anyway, in previous CTPs of the ATLAS framework, this has all worked fine. In the Beta 2 update, it appears as though the viewstate that is created on inital page view remains around. For example, I have a gridview control that contains a dropdown list in each row for sorting the items in the gridview. You click a new value in the drop down and that row is supposed to move to that row in the grid. With the current Beta 2, if I move row 5 to row 1, that works. Then I select row 5 to move to row 3 and the record in row 1 moves to row 3 instead! (row 1 contains the original row 5 so it seems to reference that row on the server and move it to 3).

I've obviously got to look at my own load/save code here but since the Beta 2 update is the only change, I'm starting with something being broken in that. Let me know if you've got any other thoughts?

Thanks.

I use compressed state myself, but again, I use only UpdatePanel.

I have implemented my own PageStatePersister / IStateFormatter instead though. I feel that this is a more proper way than overriding the method in the actual page.

Have you tried without overriding state load / save ?


If I don't use the save/load of state, everything works fine except i have a very large viewstate object being passed around.

I've found one workaround right now. The viewstate can be saved to the server as a temp file instead of going back down to the server. This appears to work so for the time being, I can use this and just have a clean up on application_end to remove the viewstate files. However, this makes me believe that the hidden input values aren't being updated properly in this beta 2.


Try to implement what I mentioned!

 
public class CompressedHiddenPageStatePersister : HiddenFieldPageStatePersisterpublic class CompressedStateFormatter : IStateFormatter

I recommend you to look at these (not garantueed to help though)

You could also just try to compress the whole thing itself, withASPX compression in IIS

Localization of the date format in CalendarExtender

Is it possible to change the format of the today date in the footer of the CalendarExtender?

The CalendarExtender localizes the text correctly (i.e. Heute for german) but the date format is always MMM dd, yyyy. I want to change that to dd.MM.yyyy for german.

I tried to change "Heute: {0}" to "Heute: {0: dd.MM.yyyy}" in the ScriptResources.de.resx resource but nothing changed.

Any ideas?

Seehttp://asp.net/AJAX/Control-Toolkit/Live/Calendar/Calendar.aspx andhttp://msdn2.microsoft.com/en-us/library/bz9tc508.aspx.

You should just be able to set the Format property to a standard format (http://msdn2.microsoft.com/en-us/library/bb79761a-ca08-44ee-b142-b06b3e2fc22b.aspx)

-Damien


dwhite:

You should just be able to set the Format property to a standard format

Which Format property do you mean? The Format property on the CalendarExtender is used to format the date that is set in the extended TextBox, not the date that is displayed in the footer of the calendar for today.

Everything is localized correctly (Days, Months, Today-string) but the date format is wrong, it is always in MMM dd, yyyy

Note:
ScriptManager.EnableScriptGlobalization and EnableScriptLocalization are both set to true.


Sorry, I understand you now.

In the CalendarBehavior.js file, line 943:

this._today.appendChild(document.createTextNode(String.format(AjaxControlToolkit.Resources.Calendar_Today, todaysDate.localeFormat("MMMM d, yyyy"))));

Try changing that format and recompile the tool kit. (Also, there may be a fix in one of the later releases on the toolkit, I didn't check).

-Damien


Thanks a lot!

I'll change that as I need it. Lucky me, all cultures I have to support use dd.MM.yyyy.

dwhite:

Also, there may be a fix in one of the later releases on the toolkit, I didn't check

Lets' hope so.

Localized Calendar

I need use a localized version of CalendarExtender, but it's not possible to change the format of today because the javascript function _performLayout set this._today.innerHTML = "Today: " + todaysDate.format("MMMM d, yyyy");

Yes, it's easy replace this line, but all the contents are localized, why not this??

Hi there will be a fix for this in the next realease of the control toolkit due 28 feb.

This has been reported as workitem 7577 more info onhttp://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7577

More info about bug fixes in the 10228 release can be found herehttp://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=1425

Hope this helps!