title: Inline editing of Webgrid row in MVC3
body: <pre><code> public class UserDetailsModel
      {
          public int ID { get; set; }
          public string LoginID { get; set; }
          public string FirstName { get; set; }
          public string LastName { get; set; }
          public string IsDeleted { get; set; }
          public DateTime CreatedOn { get; set; }
      }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public ActionResult Index()
          {
             object  model = obj.getUserList();
              return View(model);
          }
  
          public ActionResult Delete(int id)
          {
              BAL_obj.deleteUser(id);
              object model = obj.getUserList();
              return View("Index",model);
          }
  </code></pre>
  
  <p>Index.cshtml:</p>
  
  <pre><code>@model IEnumerable&lt;WebGrid1App.Models.UserDetailsModel&gt;
  
  @{
       WebGrid grid = new WebGrid(Model);
  
  }
  &lt;h2&gt;People&lt;/h2&gt;
  
  @grid.GetHtml(
      headerStyle: "headerStyle",
      tableStyle: "tableStyle",
      alternatingRowStyle: "alternateStyle", 
  
      fillEmptyRows: true,
  
      mode: WebGridPagerModes.All,
      firstText: "&lt;&lt; First",
      previousText: "&lt; Prev",
      nextText: "Next &gt;",
      lastText: "Last &gt;&gt;",
      columns: new [] {
  
  
          grid.Column("ID",header: "ID"),
          grid.Column("LoginId",header:"LoginID"),
  
          grid.Column("FirstName", canSort: false),
          grid.Column("LastName"),
  
          grid.Column("CreatedOn", 
                      header: "CreatedOn",
                      format: p=&gt;p.CreatedOn.ToShortDateString()
          ),
  
          grid.Column("", 
                      header: "Actions",
                      format: @&lt;text&gt;
                                  @Html.ActionLink("Edit",   "Edit",   new { id=item.ID} )
                                  |
                                  @Html.ActionLink("Delete", "Delete", new { id=item.ID} )
                              &lt;/text&gt;
          )
  })
  </code></pre>
  
  <p>I have done with the delete operation.
  How can I edit a row on same page and save the changes into database?</p>
  
  <p>There will edit button. When you click on it, row will be editable.
  Meanwhile edit link text is changed as Save link.
  Now when you click on Save, row needs to be updated.</p>
  
  <p>I want to do Inline editing.
  Can you please help me out with this?</p>