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 realize this is not good design, I'm just curious

1
  • 4
    Inline queries in an MVC view? Step away from the compiler... Commented Mar 5, 2010 at 1:51

2 Answers 2

5

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>
Sign up to request clarification or add additional context in comments.

Comments

0

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.

3 Comments

tried to import the namespace, however it says the namespace 'linq' doesn't exist in 'system.data' !
@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 - yes it is indeed referenced, hence i can access it in my code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.