last day (15 days later) » 

10:29 AM
0
A: MVC Controller receiving null values from ajax

Ram AnugandulaFor Example : Html : @model Project.Web.Models.UserModel @using (Html.BeginForm("AddUser", "User", FormMethod.Post, new { id = "FormPost" })) { <div class="container-fluid"> <div class="row"> <div class="col-sm-6 col"> <div class="form-group"> @Html.TextBoxFor(model =>...

 
@Html.Raw(Json.Encode(Model)) what model are you talking about in the parameter?
 
@hmzn this will hold your model values
@model <your model> in View at top
 
The answer is not clear, can you add html code of model to understand your code.
 
ok i share example code
check passing model to action ajax and see console to find model data
 
Thank you for sharing the code. The model in a console is null.
 
10:30 AM
I have update my answer with example
Check out that
 
Ok
Why I got syntax error in var model = @Html.Raw(Json.Encode(Model));
IHtmlstring HtmlHelper.Raw(string value) (+1 surcharge(s)) returns the balise that is not encoded in html
 
10:53 AM
Can show your code
 
11:36 AM
@model internship.Models.Folder
@{
ViewBag.Title = "AddOrEditFolder";
Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="card">
<div class="card-header">
<h4>إنشاء ملف جديد</h4>
</div>

<div class="card-body">
@using (Html.BeginForm(null, null, new { @id = string.Empty }, FormMethod.Post, new { @id = "Folder" }))
{
@Html.HiddenFor(model => model.FolderID)

<div class="row">
<label for="FirstNameAR" class="col-sm-2 control-label">الإسم الشخصي</label>
<div class="col-sm-4">
@Html.EditorFor(model => model.Trainee.FirstNameAR, new { htmlAttributes = new { @id= "FirstNameAr", @class = "for
I'm trying show model in a console before sending with ajax
 

last day (15 days later) »