[mapguide-users] Setting the Active Aelection with .Net

Andy Morsell amorsell at spatialgis.com
Tue Oct 10 11:07:42 EDT 2006


In your JavaScript function, are you passing the .NET selectionXml somehow?
For example:

var selectionXml = '<%= selectionXml %>';  
parent.parent.SetSelectionXML(selectionXml);

Also, can you confirm that you are getting to the SetSelectionXML() function
properly?  If your code is running in the script frame, try this instead: 

parent.mapFrame.SetSelectionXML(selectionXml);


Andy Morsell, P.E.
Spatial Integrators, Inc.
http://www.SpatialGIS.com

-----Original Message-----
From: meli-m [mailto:meli-m at arcor.de] 
Sent: Tuesday, October 10, 2006 6:55 AM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] Setting the Active Aelection with .Net


Based on the example in the Developer' Guide on page 45-48 I create an
aspx-file with following code to select a parcel by a given key.
Unfortunately nothing is selected in the map. So what's wrong with my code?
I am exspecially not sure about how the xml-file with the selection is
passed to the map. 



<%      Response.Charset = "utf-8";

        GetRequestParameters();
        mapName = "New Map";

        InitializeWebTier();

        MgUserInformation cred = new MgUserInformation(sessionId);
        MgSiteConnection site = new MgSiteConnection();
        site.Open(cred);

        MgFeatureService featureSrvc =
site.CreateService(MgServiceType.FeatureService) as MgFeatureService;
        MgResourceService resourceSrvc =
site.CreateService(MgServiceType.ResourceService) as MgResourceService;
        MgRenderingService renderingSrvc =
site.CreateService(MgServiceType.RenderingService) as MgRenderingService;

        MgMap map = new MgMap();
        map.Open(resourceSrvc, mapName);

        MgLayerCollection layers = map.GetLayers();
        string name = "ALK_Nutzungen";
        MgLayer layer = layers.GetItem(name);

        MgFeatureQueryOptions query = new MgFeatureQueryOptions();
        query.SetFilter("Key LIKE '3966/000 at 3970'");


        string featureClass = layer.GetFeatureClassName();
        
        MgResourceIdentifier featureSource = new
MgResourceIdentifier(layer.GetFeatureSourceId());
        MgFeatureReader features = featureSrvc.SelectFeatures(featureSource,
featureClass, query);

        MgSelection sel = new MgSelection(map);

        
        sel.AddFeatureIdInt32(layer, featureClass, 0);


        Response.AddHeader("Content-type", "text/xml");
        selectionXml = sel.ToXml();

%>

Additional I have a Javascript function: 

    function OnPageLoad()
    {
        parent.parent.SetSelectionXML(selectionXml);
    }


The xml-file looks like this:

 <?xml version="1.0" encoding="UTF-8" ?>
- <FeatureSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd">
- <Layer id="b9410078-ffff-ffff-8000-00142ab4c581">
- <Class id="SDF_2_Schema:ALK_Nutzungen">
  <ID>AAAAAA==</ID>
  </Class>
  </Layer>
  </FeatureSet>






Thanks in advance to all,


Melanie
--
View this message in context:
http://www.nabble.com/Setting-the-Active-Aelection-with-.Net-tf2416837.html#
a6736960
Sent from the OSGeo MapGuide mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org







More information about the Mapguide-users mailing list