All Questions

27
votes
2answers
3557 views

Post an HTML Table to ADO.NET DataTable

I have a HTML table as below in my View: <table id="tblCurrentYear"> <tr> <td>Leave Type</td> <td>Leave Taken</td> <td>Leave Bala...
320
votes
9answers
206122 views

What is ViewModel in MVC?

I am new to ASP.NET MVC. I have a problem in understanding the purpose of a ViewModel. What is a ViewModel and why do we need a ViewModel for an ASP.NET MVC Application? It is better if I can have...
37
votes
2answers
22818 views

How to append whole set of model to formdata and obtain it in MVC

How do I pass a whole set model object through formdata and convert it to model type in the controller? Below is what I've tried! JavaScript part: model = { EventFromDate: fromDate, ...
37
votes
1answers
10342 views

The ViewData item that has the key 'XXX' is of type 'System.Int32' but must be of type 'IEnumerable<SelectListItem>'

I have the following view model public class ProjectVM { .... [Display(Name = "Category")] [Required(ErrorMessage = "Please select a category")] public int CategoryID { get; set; } ...
10
votes
2answers
9342 views

The model item passed into the dictionary is of type .. but this dictionary requires a model item of type

This question and community wiki answer has been added to assist in closing out numerous unanswered questions as discussed in this meta post. I have some code and when it executes, it throws an exc...
349
votes
34answers
999899 views

JQuery - $ is not defined

I have a simple jquery click event <script type="text/javascript"> $(function() { $('#post').click(function() { alert("test"); }); }); </script> and...
413
votes
14answers
239335 views

Render a view as a string

I want to output two different views (one as a string that will be sent as an email), and the other the page displayed to a user. Is this possible in ASP.NET MVC beta? I've tried multiple examples: ...
27
votes
4answers
5083 views

POST a form array without successful

I'm developing an ASP.NET MVC 5 web with C# and .NET Framework 4.5.1. I have this form in a cshtml file: @model MyProduct.Web.API.Models.ConnectBatchProductViewModel @{ Layout = null; } <!D...
1266
votes
36answers
787409 views

A potentially dangerous Request.Form value was detected from the client

Every time a user posts something containing < or > in a page in my web application, I get this exception thrown. I don't want to go into the discussion about the smartness of throwing an excep...
403
votes
19answers
118766 views

How can I properly handle 404 in ASP.NET MVC?

I am just getting started on ASP.NET MVC so bear with me. I've searched around this site and various others and have seen a few implementations of this. EDIT: I forgot to mention I am using RC2 Us...

Previous Next