tags:

views:

211

answers:

2

is there any reason the namespace 'linq' does not appear in system.data when i am in my view in asp.net MVC?

i can access the namespace fine in my code...

EDIT:

i realise this is not good design, i'm just curious

A: 

You can try <%@ Import Namespace="System.Data.Linq" %>

But, why do you even need LINQ in your view? You might want to consider keeping the logic you need in a HtmlHelper or your controller.

Kirschstein
tried to import the namespace, however it says the namespace 'linq' doesn't exist in 'system.data' !
benpage
@benpage - Is System.Data.Linq referenced in your project? Note: I have agree with this answer, you shouldn't have anything that needs linq here...
Nick Craver
@nick - yes it is indeed referenced, hence i can access it in my code
benpage
A: 

You may need to add an assembly reference in your project web.config file if it's not there:

<system.web>
    <compilation debug="true">
        <assemblies>
            <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        </assemblies>
    </compilation>
</system.web>
Todd