Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
First Linq To XML query - having problems
Message
 
To
14/04/2009 14:21:36
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
LINQ
Miscellaneous
Thread ID:
01394795
Message ID:
01394804
Views:
54
>Here's my query:
>
>            var query = from m in _AdministrativeTabMappings.Elements("Mappings").Elements("Mapping")
>                        where m.Attribute("Page").Value == page
>                        select m;
>
>
>Query always returns a NullReferenceException. This works without the where clause. Page is a variable which I confirmed equals "bonds/administrator/AdministratorHome.aspx".

Page isn't an attribute, it's an element. An attribute would be something like:
<Page name="MyNameAttribute"Value</Page
I can't test this, but maybe something like this would work?
var query = from m in _AdministrativeTabMappings.Elements("Mappings").Decendants("Page")
                        where m.Value == page
                        select m;
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform