I think you don't need the PageName + ClientID, but even so, you may keep it. In my opinion you should just change the PageName property to something like I told.
But you could just make a simple test:
1.put the PageName property writable
2. create a page with the map control
3. In Page_load add: if(!Page.IsPostback) this.map1.PageName="thisIsMyPageName";
4. see what happens.
(or send me a compiled version with this property writable and I'll give it a try)
Now, one other point just to see if I'm understanding, if we have:
public class ServerControl1 : WebControl
{
private Object _something;
public String MapControlSessionIdentifier
{
get {
if(ViewState["MapControlSessionIdentifier"] == null)
ViewState["MapControlSessionIdentifier"] = Guid.NewGuid().ToString().Replace("-", "");
return (String)ViewState["MapControlSessionIdentifier"];
}
set {
ViewState["MapControlSessionIdentifier"] = value;
}
}
protected override object SaveViewState()
{
HttpContext.Current.Session[this.MapControlSessionIdentifier + "something"] = _something;
return base.SaveViewState();
}
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
_something = HttpContext.Current.Session[this.MapControlSessionIdentifier + "something"];
}
}
Won't this work?
Once again for you not to change to much code logic (C# and JavaScript), I think that you should stick with the PageName + ClientId approach, but just make the PageName more independent (or even writable).
What you say?