Je suis coincé sur un point avec ASP MVC, j'expliquer mon problème,j'ai une vue partielle (parent) qui appelle trois vue partielle, et dans la vue partielle parent j'ai un bouton qui soumet le contenu des champs qui sont dans les trois vue partielle, mon problème est la : comment je pourrai soumettre les champs des vue partielle enfant à partir de la vue parent, voici mon code :
vue principale :
vu enfant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 @model CB.CRMS.Web.Pages.Participant.GetParticipant.GetParticipantModel <button type="submit" class="btn fsc-btn-3"> //this button must submit the field in the partiel view 1 <i class="fa fa-check"></i> <span>Enregistrer Tous</span> </button> <div class="fsc-comp-card-system-1" > <div class="fsc-comp-flipcard-1" id="data-flipcard"> @Html.Partial("_ParticipantData", Model) </div> <div class="row"> <div class="col-xs-4"> <div class="fsc-comp-flipcard-1" id="cdr-flipcard"> @Html.Partial("_DataCDR", Model) </div> </div> <div class="col-xs-4"> <div class="fsc-comp-flipcard-1" id="classification-flipcard"> @Html.Partial("_Classification", Model) </div> </div> </div> </div>
Controlleur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 @model CB.CRMS.Web.Pages.Participant.GetParticipant.GetParticipantModel <div class="fsc-card-body-fixed"> @Html.ValidationSummary(true) @using (Ajax.BeginForm("EditParticipantData", "GetParticipant", new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = "data-flipcard", OnBegin = "flipCard_1(jQuery(this), 0);", } )) { </div> <div class="col-xs-3"> <div class="fsc-inputfield-1"> @Html.EditorFor(m => m.Participants.Fullname, new { htmlAttributes = new { @class = "form-control" } }) </div> </div> <div class="col-xs-1"> <label class="fsc-label-1">Pays d'Origine</label> </div> <div class="col-xs-2"> <div class="fsc-inputfield-1"> @Html.DropDownListFor(m => m.Participants.Country, Model.CountryList, new { @class = "form-control" }) </div> </div> }
pour ça j'ai essayé avec jquery ajax mais mon code n'a pas l'air correcte et je ne sais pas trop comment faire :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 [HttpPost,ActionName("Index")] public ActionResult EditParticipantALL(GetParticipantModel model) { model.FillDDL(); if (ModelState.IsValid) { model.EditParticipantAll(); } return Json(model); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 jQuery('#buttonsub').click(function () { jQuery.ajax({ url: '@Url.Action("EditParticipantALL")', type: "POST", dataType: "json", data: JSON.stringify({ fullname: jQuery('#fullname').val() })}); flipCard_1(jQuery('.fsc-comp-flipcard-1'),0) })
Partager