Could any body explain, when to use
TempData
ViewBag
ViewData
I have a requirement, where I need to set a value in a controller one, that controller will redirect to Controller Two and Controller Two will render the View.
I have tried to use…
I have a simple actionmethod, that returns some json. It runs on ajax.example.com. I need to access this from another site someothersite.com.
If I try to call it, I get the expected...:
Origin http://someothersite.com is not allowed by…
I have ASP.NET MVC3 app and I have also form for add news. When VS2010 created default view I have only text inputs for string data, but I want to have textarea for news text. How I can do it with Razor syntax.
Text input look like…
I have an ASP.NET MVC 3 application. This application requests records through jQuery. jQuery calls back to a controller action that returns results in JSON format. I have not been able to prove this, but I'm concerned that my data may be getting…
How do I access a key value from web.config in my Razor view.
This is in my web.config in the Web Project root level.
I want to have to use the key in my Razor view.
Thank you.
I am having trouble with the AntiForgeryToken with ajax. I'm using ASP.NET MVC 3. I tried the solution in jQuery Ajax calls and the Html.AntiForgeryToken(). Using that solution, the token is now being passed:
var data = { ... } // with token, key is…
How to write a comment in a MVC view, that won't be transmitted to the final HTML (i.e.,to browser, to response). One can make a comment with:
but, it is visible in the page source code in browser.
Is it possible…
Ok, I have tri-leveled entities with the following hierarchy: Course -> Module -> Chapter
Here was the original EF LINQ statement:
Course course = db.Courses
.Include(i => i.Modules.Select(s => s.Chapters))
.Single(x…
Why by default were these changed when adding a new "edit" view? What are advantages when using EditorFor() vs. TextboxFor()?
I found this
By default, the Create and Edit scaffolds now use the Html.EditorFor helper instead of the Html.TextBoxFor…
Reading this, I learned it was possible to allow a method to accept parameters of multiple types by making it a generic method. In the example, the following code is used with a type constraint to ensure "U" is an IEnumerable.
public T…
I deployed my MVC-3 application on windows Azure. But now when I am requesting it through staging url it shows me (Sorry, an error occurred while processing your request.). Now I want to see the full error message, by default it is hiding that…