I recently found and have been using a tool to view the ViewState data within a page.
Web Development Helper (written by a software architect in the .NET Dev Platform group over at Microsoft):
projects.nikhilk.net/WebDevHelper
The really cool feature is "View view state in the page in raw, decoded, and parsed forms, to understand what is being generated into the view state (esp. useful for control developers)."
It works great on every page in my application, except ones with a Map. Can you think of any reason why including a map would keep it from working?
ViewState viewer can't parse pages with a Map Control
Hi, Rob
I have tested it and I could see the data using the tool. One thing I need to clarify is that we almost don’t use the ViewState to persist the page state in our map control.
Thanks,
Khalil
Were you able to see the decoded and parsed data? or just the raw? If so, can you get it working in any of the samples?
I always get "There was an unknown error parsing and decoding the viewstate." as soon as a map is on the page.
I noticed when I disable ViewState on just the map control, the viewstate goes down by over 4,000 characters. Seems like pretty decent sized ViewState persistence.
Hi, Rob
I just set up another web app not use the installed samples. And I could see the decoded and parsed data. If you have added the map tools into app and the size of ViewState will increase much more.
Thanks,
Khalil
Rob,
Please refer to the article related to the link below:
consultingblogs.emc.com/stevenevans/archive/2008/05/19/asp-net-features-of-web-development-helper.aspx
If you still have problems about that, please let me know.
Thanks,
Khalil
I have the ASP.NET tab working, and can see the decoded ViewState, as long as there is no map control on the page, or if it is set to EnableViewState=false. As soon as the map control is contributing viewstate data, it can not decode it.
If you have it working in a web app with a map control, can you send me the project?
Hi, Rob
I don’t added any map control on it except the MouseMapTool which is added by default.
Also If you have added another map control, the error occurs. I also don’t know why. We have mark all the controls using Serializable attribute.
Sorry for that.
Thanks,
Khalil
I think we aren’t on the same page here. When I say map control, I mean the actual ThinkGeo Map Control. I just want to checkout the viewstate of a page with a single Map on it. So far, it is unable to decode it. If it is working on your end, can you send me the project/solution?
Hi, Rob
I have tested it using one simple page with one map control on it. Please refer to the attachment.
Thanks,
Khalil
2004-CheckViewState.zip (120 KB)
I found that calls to anything in Map1.MapTools make the ViewState grow and keeps the viewer from being able to decode it. If I omit calls to MapTools in my Page_load, the viewstate is much smaller. In fact, I got it down to 128 characters by defining everything in the aspx instead of the codebehind.
<cc1:Map ID="Map1" runat="server" Height="480px" Width="640px" IsAllowResoucesCopied="true" IsWebConfigRegistable="true">
The viewstate even grows when reading the values from Map1.MapTools. Mine jumps from 128 chars to 3864 chars.
There are only 2 items I need to access in there: turn off ThinkGeo logo, and set my own LoadingImage. Is there another way to add those properties? Maybe add it to the Map JSON before it gets parsed?
Map1.MapTools.LoadingImage.Enabled = true;
Map1.MapTools.LoadingImage.Width = 100;
Map1.MapTools.LoadingImage.Height = 50;
Map1.MapTools.LoadingImage.ImageUri = new Uri("/images/loading.gif", UriKind.Relative);
Map1.MapTools.Logo.Enabled = false;
Hi, Rob
Yes, I know that’s a problem. I have added it to our task list and we will fix it in the next release edition.
Thanks,
Khalil
In case anyone was wondering… I was able to work around this by overriding the mapParser.initLoadingControl(). This way my codebehind never calls any MapTools directly, and keep the ViewState down to a minimum. Let me know when the problem is fixed, and the override is no longer needed.
Class.Extent(mapParser.prototype, {
initLoadingControl: function(json) {
// custom settings
json.controls.LoadingImage = {‘uri’:’/images/loading2.gif’,‘w’:100,‘h’:50,‘enabled’:true};
json.controls.Logo.enabled = false;
var loadObjId = ‘loading’ + json.cid;
var loadObj = document.getElementById(loadObjId);
var loadJsonObj = json.controls.LoadingImage;
if (loadJsonObj.enabled && (loadObj == null || loadObj == ‘undefined’)) {
loadObj = CreateImageNode(loadObjId, loadJsonObj, parseInt(this.map.div.clientWidth), parseInt(this.map.div.clientHeight), json.rootPath + LoadingImageUrl);
this.map.div.appendChild(loadObj);
}
}
});
Rob,
Ok, we will let you know if we have any progress on it.
Thanks,
Khalil