In my hybrid project i can not create a viewbag

brtb

I had a classical web forms application. I wanted to be add mvc 4 in it.

For this manner i added necessary references. i made some changes in web.config

and i created two folders named Views and Controllers. And then i added a view in Views folder. The code like this

 @{
 ViewBag.Title = "About";
}

<ul>
    <li>@Html.ActionLink("Home", "Index", "Home")</li>
    <li>@Html.ActionLink("About", "About", "Home")</li>
    <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>

but i m having errors al the time.

The name ViewBag does not exist in current context.

what can be problem.

backtrack

you have missed some Web.config int the view folder /Views/Web.Config

 <configuration>

 <system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

  <pages pageBaseType="System.Web.Mvc.WebViewPage"> // <-- this line and contents are important
    <namespaces>
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Routing" />
    </namespaces>
  </pages>

try this and let me know

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How can I add this module to my Android Studio project?

분류에서Dev

How can I create my own spelling file for vim?

분류에서Dev

Why can't I create a new Thread with an instance of my class?

분류에서Dev

How can I create my class in different file?

분류에서Dev

How can I create Unity dash integration for my Python script?

분류에서Dev

Android - How can i create a "black list" for the files of my application

분류에서Dev

how can i link an XML data file from my hard drive (not web) to my project?

분류에서Dev

How can I publish my project code online so someone can help me with it?

분류에서Dev

Should I copy six.py into my project or I can add it into setup requires instead?

분류에서Dev

Can I place the composer.json file for my project not on the root directory?

분류에서Dev

Why can't I add the newtonsoft.Json.dll ref to my project?

분류에서Dev

How can I use Apache CXF 2.6.7 as dependency of my war project and not CXF that is installed in the modules of JBoss 7.1?

분류에서Dev

In Android Studio how can I configure my project to use Java 8

분류에서Dev

How can I create a feature branch from code changes in my development branch that I haven't checked in?

분류에서Dev

How can I automatically create a Btrfs Snapshot before updating my system?

분류에서Dev

Why can't I create a partition table on my USB flash drive using GParted?

분류에서Dev

Erros when i create a new android project

분류에서Dev

Can I virtualize my ubuntu?

분류에서Dev

I can't start a new project on Netbeans

분류에서Dev

Can I await an enumerable I create with a generator?

분류에서Dev

How can I use a Maven project as a dependency to another Maven project?

분류에서Dev

Why after referenced dll files to my project they are not on my release directory when i build the project?

분류에서Dev

Can't able to run react-native-maps in my Project

분류에서Dev

What frameworks/technology stack should I use for my Java project?

분류에서Dev

How can I benchmark my HDD?

분류에서Dev

How can I find my DHCP server?

분류에서Dev

I can't update my rails form

분류에서Dev

How can I find my DHCP server?

분류에서Dev

I can't display my table (codeigniter)

Related 관련 기사

  1. 1

    How can I add this module to my Android Studio project?

  2. 2

    How can I create my own spelling file for vim?

  3. 3

    Why can't I create a new Thread with an instance of my class?

  4. 4

    How can I create my class in different file?

  5. 5

    How can I create Unity dash integration for my Python script?

  6. 6

    Android - How can i create a "black list" for the files of my application

  7. 7

    how can i link an XML data file from my hard drive (not web) to my project?

  8. 8

    How can I publish my project code online so someone can help me with it?

  9. 9

    Should I copy six.py into my project or I can add it into setup requires instead?

  10. 10

    Can I place the composer.json file for my project not on the root directory?

  11. 11

    Why can't I add the newtonsoft.Json.dll ref to my project?

  12. 12

    How can I use Apache CXF 2.6.7 as dependency of my war project and not CXF that is installed in the modules of JBoss 7.1?

  13. 13

    In Android Studio how can I configure my project to use Java 8

  14. 14

    How can I create a feature branch from code changes in my development branch that I haven't checked in?

  15. 15

    How can I automatically create a Btrfs Snapshot before updating my system?

  16. 16

    Why can't I create a partition table on my USB flash drive using GParted?

  17. 17

    Erros when i create a new android project

  18. 18

    Can I virtualize my ubuntu?

  19. 19

    I can't start a new project on Netbeans

  20. 20

    Can I await an enumerable I create with a generator?

  21. 21

    How can I use a Maven project as a dependency to another Maven project?

  22. 22

    Why after referenced dll files to my project they are not on my release directory when i build the project?

  23. 23

    Can't able to run react-native-maps in my Project

  24. 24

    What frameworks/technology stack should I use for my Java project?

  25. 25

    How can I benchmark my HDD?

  26. 26

    How can I find my DHCP server?

  27. 27

    I can't update my rails form

  28. 28

    How can I find my DHCP server?

  29. 29

    I can't display my table (codeigniter)

뜨겁다태그

보관