title: hide and show ActionLink and save data in database - MVC
body: <p>I am working on a MVC application and I have to turn labels into textboxes when user clicks <code>Edit</code> which is working fine but after clicking <code>Edit</code> and showing the textboxes <code>Edit</code> should hide and <code>Save</code> should appear and on clicking <code>Save</code> data should be save in database and should be refreshed on page.
  But <code>Edit</code> ActionLink isn't hiding and <code>Save</code> ActionLink isn't appearing. and edited data is also not saving in database.</p>
  
  <p>jQuery Code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          $(document).ready(function() {
              $('a.Edit').click(function () {
                  var dad = $(this).parent().parent();
                  $('a.edit').hide();
                  $('a.save').show();
                  dad.find('.displaytext').hide();
                  dad.find('input[type="text"]').show();
              });
  
          $('a.Save').click(function() {
              var dad = $(this).parent();
              //$(this).hide();
              $('a.edit').show();
              $('a.save').hide();
              dad.find('.displaytext').show();
              url = $(this).attr('href');
              $(this).load(url);
          });
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>HTML Code:</p>
  
  <pre><code>    &lt;table&gt;
          &lt;tr&gt;
              @*&lt;th&gt;
                  @Html.Label("ID")
              &lt;/th&gt;*@
              &lt;th&gt;
                  @Html.Label("Name")
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.Label("Description")
              &lt;/th&gt;
              &lt;th&gt;
                   @Html.Label("Date")
              &lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
          &lt;/tr&gt;
  
      @foreach (var item in Model)
      {
          if (Convert.ToDateTime(item.Holiday_date).Year.ToString() == DateTime.Now.Year.ToString())
          {
              &lt;tr&gt;
             @* &lt;td&gt;
                  @Html.TextBoxFor(modelItem =&gt; item.Holiday_Id, new { style = "display: none; width:170px; height:15px" })
                  &lt;div class="displaytext"&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Holiday_Id)
                  &lt;/div&gt;
              &lt;/td&gt;*@
              &lt;td&gt;
                  @Html.TextBoxFor(modelItem =&gt; item.Holiday_Name, new { style = "display: none; width:170px; height:15px" })
                  &lt;div class="displaytext"&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Holiday_Name)
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.TextBoxFor(modelItem =&gt; item.Holiday_Description, new { style = "display: none; width:170px; height:15px" })
                  &lt;div class="displaytext"&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Holiday_Description)
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.TextBoxFor(modelItem =&gt; item.Holiday_date, new { style = "display: none; width:170px; height:15px" })
                  &lt;div class="displaytext"&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Holiday_date)
                  &lt;/div&gt;
              &lt;/td&gt;
              &lt;td&gt;
                 @Html.ActionLink("Edit", "Edit", new { id = item.Holiday_Id }, new { @class = "Edit", Href="#" })
                 @Html.ActionLink("Save", "Save", new { id = item.Holiday_Id}, new { @class = "Save", Href = "#", style = "display:none" } ) |
                 @Html.ActionLink("Delete", "Delete", new { id = item.Holiday_Id }, new { @class = "lnkDelete" })
              &lt;/td&gt;
          &lt;/tr&gt;
          }
  
      }
  
      &lt;/table&gt;
  </code></pre>
  
  <p>Controller Code:</p>
  
  <pre><code>[HttpGet]
          public ActionResult Edit(int id = 0)
          {
              tbl_HolidayList tbl_holidaylist = db.tbl_HolidayList.Find(id);
              if (tbl_holidaylist == null)
              {
                  return HttpNotFound();
              }
              return PartialView(tbl_holidaylist);
          }
  
          //
          // POST: /Holiday/Edit/5
  
          [HttpPost]
          public ActionResult Edit(tbl_HolidayList tbl_holidaylist)
          {
              if (ModelState.IsValid)
              {
                  db.Entry(tbl_holidaylist).State = EntityState.Modified;
                  db.SaveChanges();
                  TempData["Msg"] = "Data has been updated succeessfully";
                  return RedirectToAction("Index");
              }
              return PartialView(tbl_holidaylist);
          }
  </code></pre>
  
  <p>can anyone tell me my mistake?</p>