Search code examples
c#asp.net-mvcwebformsviewstate

ViewState in the ASP.NET, does it really go away?


I have read different topics, tutorials etc... Everywhere there is an information that ASP.NET MVC has an advantage for not using/containg a ViewState stuff.

Really?

So... How could it be (look at the screenshot)?

http://s18.postimg.org/rvgm2ypjt/Screenshot_568.png

As you can see in the screen it isn't a WebForms project.

I just added the next code in the one View:

http://ideone.com/iPkmdO

Why do I have a Viewstate in my ASP.NET MVC project?


Solution

  • <form class="form-horizontal" id="MainForm" runat="server">
    

    If you are using runat="server", then you are invoking webforms; don't do that. This is MVC - you don't need that. Just change it to:

    <form class="form-horizontal" id="MainForm">