I have a field in my view, called Comments and every time I include the < in before any other character(letters, etc) in the 'input', the action controller is not being called, I think is because is not being able to parse correctly to string,
This is how the property in my class is declared:
[Display(Name = "Comments"), DataType(DataType.MultilineText)]
public string my_comments { get; set; }
It works fine when I enter any word, for example:
dog, [email protected], >asa?
But if I try something like:
<[email protected]>, <p, <asa>, asasd<f
the action is not being called and I think is because this is not being able to parse the input to an string...
If I include the < character at the end, no problem it pass.., for example:
ddd<
I'm using JQuery in my view:
$("#btnSubmit").click(function () {
$.ajax({
type: 'post',
url: $("#btnSubmit").data("url"),
data: $("#formEd").serialize(),
success: function (result) {
....
}})
})
Html:
<div class="form-group">
<div class="control-label col-md-2">Comments</div>
<div class="col-md-5">
@Html.EditorFor(model => model.my_comments , new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.my_comments , "", new { @class = "text-danger" })
</div>
</div>
And my action controller:
[HTTPPost]
public ActionResult MyAction(MyClass parameter) // where MyClass contains the my_comments property...