Reputation: 41
$.post('AddDocument',
{ Title: $('#Title').val(), Description: $('#Description').val(),DocumentBody: '<p>aaaa</p>' },
function (data, status, obj) {
});
}
});
this is the code from my view to call the server side code my problem is when im about to pass the string HTML tag in controller its not working any idea? im having a hardtime with this thank you.. look at the DocumentBody its a string but its not working the controller didnt get the value is it because its a HTML???
Upvotes: 0
Views: 1517
Reputation: 15148
In addition to what user2675751 suggested, another option would be to set ValidateInput(false)
on your controller's action:
[HttpPost, ValidateInput(false)]
public ActionResult AddDocument(MyViewModel viewModel) {
// your code here
}
Upvotes: 0
Reputation: 1495
just in your Model add [AllowHtml] attribute
[AllowHtml]
public string DocumentBody { get; set; }
Upvotes: 4