[mapguide-users] Re: Edit WebLayout Problem
Ivan Miličević
Ivan.Milicevic at supranet.hr
Wed Apr 14 08:36:59 EDT 2010
Why don't you hide toolbar on client side via javascript?
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of SriRam007
Sent: Wednesday, April 14, 2010 12:28 PM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] Re: Edit WebLayout Problem
I m trying to make tool bar invisible
this is the code how i m doing But not working
protected void btn_Click(object sender, EventArgs e)
{
Utility.InitializeWebTier(Request);
MgUserInformation userInfo = new
MgUserInformation(Session["ID"].ToString());
MgSiteConnection siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);
MgResourceService resourceService =
siteConnection.CreateService(MgServiceType.ResourceService) as
MgResourceService;
MgMap map = new MgMap();
map.Open(resourceService, "Sheboygan");
MgResourceIdentifier WebLayoutId = new
MgResourceIdentifier("Library://Samples/Sheboygan/Layouts/SheboyganAsp.WebLayout");
MgByteReader byteReader =
resourceService.GetResourceContent(WebLayoutId);
string xmlLayoutDef = byteReader.ToString();
string MapDefinitionStr = ReplaceTextNodeValue(xmlLayoutDef,
"false");//Here i m finding the tool bar node and then visible node and
replacing the value true to false
XmlDocument newLayoutXML = new XmlDocument();
newLayoutXML.LoadXml(MapDefinitionStr.ToString());
MgResourceIdentifier MapResId = new MgResourceIdentifier("Session:"
+ Session["ID"].ToString() + "//" + "SheboyganAsp.WebLayout");
resourceService.SetResource(MapResId, new
MgByteReader(MapDefinitionStr, "text/xml"), null);//WebLayoutId
resourceService.UpdateRepository(MapResId, new
MgByteReader(MapDefinitionStr, "text/xml"), null);
map.Save(resourceService);
ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
"RefreshMap", "parent.parent.mapFrame.Refresh();", true);
}
private static string ReplaceTextNodeValue(string byteReaderStr, string
ReplaceValue)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(byteReaderStr.ToString());
XmlNodeList ToolBarnodeList = doc.GetElementsByTagName("ToolBar");
foreach (XmlElement node in ToolBarnodeList)
{
XmlNodeList VisibleNodeList =
node.GetElementsByTagName("Visible");
if (VisibleNodeList.Count > 0)
{
VisibleNodeList.Item(0).FirstChild.Value =
ReplaceValue.ToString();
}
}
string MapDefinitionStr = doc.OuterXml.ToString();
return MapDefinitionStr;
}
Please anyone help me where i did wrong
thanks
--
View this message in context: http://n2.nabble.com/Edit-WebLayout-Problem-tp4869470p4900872.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
More information about the mapguide-users
mailing list