[mapguide-users] MapGuide Programming using C#, need help, please

Ivan Milicevic Ivan.Milicevic at supranet.hr
Tue Feb 10 10:08:18 EST 2009


Hey,

Try this one:

MgLayer layer = GetLayerByName(map, "ROADS");

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of staniz
Sent: Tuesday, February 10, 2009 4:01 PM
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] MapGuide Programming using C#, need help,
please


Dennis, I am really sorry for making you confused because I mistyped the
code.
These are the original code that I copied from aspx that i got the first
error.

//Highlight the query result on the map
    MgSelection selection = new MgSelection(map);
    MgLayer layer = map.GetLayers().GetItem("Parcels");
    featureReader = featureService.SelectFeatures(parcelId, "Parcels",
nameQuery);
    selection.AddFeatures(layer, featureReader, 0);
    String selectionXML = selection.ToXml();

I changed the line to  ---MgLayerBase layer =
map.GetLayers().GetItem("Parcels");--- 
as your suggestion but the Query result is still empty.

I am sorry.



staniz wrote:
> 
> I am using MGE Server and Studio 2008, windows XP and IIS 5.1. I
> downloaded sample code from
>
http://download.autodesk.com/media/adn/DevTV_%20Introduction_to_MGE_Prog
ramming/SampleCode.zip
> these code is recommended for MGE2007, but I think its also work for
> MGE2008.
> I followed all the instruction in video, and ran the default.aspx. Its
> worked by but When I was trying to run the Query.aspx and execute the
> DisplayQueryResult.aspx I got the following error:
> 
> ----
> Compiler Error Message : CS0266:
> cannot implicitly convert type
> `OSGeo.Mapguide.MgLayerBase` to
> `OSGeo.Mapguide.MgLayer`. An explicit 
> conversion exist (are you missing a cast?)
> 
> Source code:
> Line 58:  MgLayer layer =map.Getlayer().GetItem("Parcels");
> 
> .Net framwork Version:2.0.50727.42
> ----
> 
> please help to solve this problem...
> thanks is advance.
> 
> staniz
> 
> 
> 
> 
> 
> 

-- 
View this message in context:
http://n2.nabble.com/MapGuide-Programming-using-C-%2C-need-help%2C-pleas
e-tp2301814p2302955.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