How InsertionMode.Replace works in Ajax.BeginForm

I have the following Ajax.beginforminside my asp.net mvc view, where the result of the ajax call will replace <div id= "searcharea">as follows: -

@using (Ajax.BeginForm("Search", "Patient",
    new AjaxOptions
{
    HttpMethod = "GET",
    InsertionMode = InsertionMode.Replace,
    UpdateTargetId = "searcharea",
    LoadingElementId = "progress2"
}))
{
   <table >

 <tr>

        <th>
         Searching By First Name (English) :-
        </th>
        <th>
          <input type="text" name="firstname"  />
        </th></tr>
      <tr>

        <th>
         Searching By Family Name (English) :-
        </th>
        <th>
          <input type="text" name="familyname"  />
        </th></tr>

      <input type="submit" value="Search      " /></th><th></th></tr>
  </table>

}

<div id = "progress2">
<img src= "@Url.Content("~/Content/images/Ajax-loader-bar.gif") ">
</div>
<p>
<div id= "searcharea">
</div>

So, in the beginning, although I can only perform one search, since it <div id= "searcharea">will be replaced by the result of the ajax call, and after that it will not be avilalbe, and if I try to make anther the ajax call will be larger <div id= "searcharea">to replace the result.

, - , , InsertionMode.Replace DOM ajax DOM, , , DOM , ajax???!! - , ? BR

+3
1

InsertionMode.Replace. HTML-, UpdateTargetId, .

,

$("#searcharea").html(newHTMLcontent);

, , , , : .

+10

All Articles