asp.net mvc 4 - Partial view disapear when form submit ajax.beginform -


i want ask how can retain partial view when submit form using ajax.beginform...my partial view disappear when submit form

here code

@using (ajax.beginform("hardwareproblem", new ajaxoptions { httpmethod = "post" }))  {      @html.antiforgerytoken()      <div>          <div id="errodiv" class="message-error" style="position:absolute;"> </div>          <div id="successdiv" class="message-success" style="position:absolute;"> </div>            <ul class="po_btn_l1">              <li><a href="#" class="btn print">print report</a></li>              <li><a href="#" class="btn pop-up">pop-up complete list</a></li>              <li><a href="#" class="btn screen-shot">screen shot</a></li>              <li>                    @html.textbox("search po_no", "goto po #", new { @class = "po_search" })              </li>          </ul>          <ul class="po_btn_l2">              <li><input type="submit" value="save & exit" class="btn save-exit"></li>              <li><a href="#" class="btn discard-changes">discard changes</a></li>              <li><a href="#" class="btn delete">delete</a></li>              <li><a href="#" class="btn cancel">cancle</a></li>          </ul>      </div>      <div class="ca-dbhdng" style="width:96%; height :5px; padding:0px;">          @*<i class="dash-ico-b"></i><h2 style="color: #21355c; font-size:11px;"> dashboard > purchase order</h2>*@      </div>      <fieldset class="fieldset">          <table class="tbl-barcode" style="width: 959px; float: left; padding-bottom: 20px; ">              <tbody>                  <tr>                      <td><span class="number">01.</span></td>                      <td class="label-text">                          <label> gulfit po # : </label>                      </td>                      <td>                          @html.textboxfor(model => model.gulfitpo_no,                                                              new { @class = "text-field-search validate[required]" })                          <input type="button" value="search" id="get_po_data" class="po_searchm" />                          @html.hiddenfor(model => model.po_id, new { @type = "hidden", @id = "po_id" })                      </td>                      <td><span>04.</span></td>                      <td class="label-text">                          <label>current laptop department:</label>                      </td>                      <td>                          @html.textboxfor(model => model.laptop_po_qty, new { @class = "text-field-readonly validate[required]", @readonly = "readonly" })                      </td>                  </tr>                  <tr class="spaceunder">                      <td><span class="number">02.</span></td>                      <td class="label-text">                          <label> laptop serial no: </label>                      </td>                      <td>                          @html.textboxfor(model => model.laptop_sr_no,                                                              new { @class = "text-field-search validate[required]" })                          <input type="button" value="search" id="get_laptop_srno" class="po_searchm" />                          @html.textbox("po_id", "", new { @type = "hidden", @id = "po_id" })                      </td>                      <td><span>05.</span></td>                      <td class="label-text">                          <label>shift department:</label>                      </td>                      <td>                          <select id="delivery_stauts_id" class="dropdown">                              <option>select</option>                              <option>received</option>                              <option>labchecking</option>                              <option>workshop repair</option>                              <option>paint shop</option>                              <option>ready sale</option>                              <option>sold</option>                              <option>stor parts</option>                              <option>scrap laptop </option>                          </select>                      </td>                  </tr>                  <tr>                      <td><span class="number">03.</span></td>                      <td class="label-text">                          <label> gulf barcode: </label>                      </td>                      <td>                          @html.textboxfor(model => model.crnt_gulgit_barcode,                                                              new { @class = "text-field-search validate[required]" })                          <input type="button" value="search" id="get_crnt_barcode_data" class="po_searchm" />                          @html.textbox("po_id", "", new { @type = "hidden", @id = "po_id" })                      </td>                      <td colspan="2">&nbsp;</td>                      <td>                          <input type="submit" value="update , move" class="btn save-exit">                      </td>                  </tr>              </tbody>          </table>          <div class="ca-dbhdng" style="width:96%; height :5px; padding:0px;">              @*<i class="dash-ico-b"></i><h2 style="color: #21355c; font-size:11px;"> dashboard > purchase order</h2>*@          </div>            <div id="wp-hardware_problem1">                            </div>      </fieldset>  }

       [httppost]          [validateantiforgerytoken]          public actionresult hardwareproblem(wh_hardware_problem_model rec)          {                                            /// inserting partial view form code                                      return view();          }

here partial view

@model estock.models.workshop.wh_hardware_problem_model        <ul style="width: 958px; margin-top: 10px;">      <li style="display:inline-block;"><h2>hardware problem noted</h2></li>      <li style="float:right;"><input type="submit" value="update all" class="btn save-exit"></li>  </ul>    <ul class="wp-hpn-headings">        <li style="width:170px; padding-left:0px;"><h3>part name</h3> </li>      <li><h3>problem</h3><i>(spoted lab)</i></li>      <li><h3>solved</h3> (yes or no)</li>      <li><h3>reason</h3></li>  </ul>    @{int count = 1;        }  @for (int = 0; < model.wh_hardwareproblem_dtl.count; i++)  {      <ul class="wp-ps-listing bg-white">          <li class="w_p_z">                           @count<span>.</span>              <h3>                  @html.hiddenfor(m => model.wh_hardwareproblem_dtl[i].hardwarepartid)                  @html.labelfor(m => model.wh_hardwareproblem_dtl[i].partname, model.wh_hardwareproblem_dtl[i].partname)              </h3>          </li>          <li>                        @html.labelfor(m => model.wh_hardwareproblem_dtl[i].nature_of_prob, model.wh_hardwareproblem_dtl[i].nature_of_prob)</li>          <li>              @html.radiobuttonfor(model=>model.wh_hardwareproblem_dtl[i].problemsolved_status,"1")              @html.radiobuttonfor(model => model.wh_hardwareproblem_dtl[i].problemsolved_status, "2")              @html.radiobuttonfor(model => model.wh_hardwareproblem_dtl[i].problemsolved_status, "3")          </li>                 <li style="width:290px;">              @html.textboxfor(m => model.wh_hardwareproblem_dtl[i].reason, model.wh_hardwareproblem_dtl[i].reason)            @*  <input type="text" class="text-field" />*@          </li>      </ul>      count++;  }

my partial view disappear when submit form..how able show strong text

from can see you're not calling partial view in parental(main) view.

like this:

<div>         @html.partial("partialview", model.partialmodel)        </div> 

if you're using razor, can user renderpartial.

@html.partial("viewname")  //html.partial  @{ html.renderpartial("viewname");  }  //html.renderpartial 

Comments