TextArea in mvc web grid

MVC WebGrid
From my recent work i have just need to display tabular data into the textarea and the spinner fields of the MVC WebGrid. For the Spinner fields i have completed work on WebGrid. So now we have the another task to embed the simple html textarea in to WebGrid. For it i am Using the format templated razor delegate by just passing this into the WebGrid Columns() method.
You can use format for display any htmlhelper element. The following code snippets will show you the Textarea in WebGrid. So lets start with the Model

Model:

namespace MvcApplication1.Models
{
    using System;
    using System.Collections.Generic;
 
    public partial class tbl_Employee
    {
        public int EmployeeId { get; set; }
        public string EmpName { get; set; }
        public Nullable<int> Age { get; set; }
        public Nullable<decimal> Salary { get; set; }
        public Nullable<int> Department_id { get; set; }
        public string Notes{ get; set; }
    }
}

textarea in webgrid mvc
View:

@model MvcApplication1.Models.Employee
@{
    ViewBag.Title = "Index";
}
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
 
<table>
    @{
  Func<dynamic, object,object> b = @<strong>@item</strong><h2>@item2</h2>;
}
    <tr>@b("hello","test")</tr>
    <tr>
        <td>
            <div id="EmployeeViewGrid">
            @{  
                var grid1 = new WebGrid(source: Model.Employee_Grid, canPage: true, rowsPerPage: 5, ajaxUpdateContainerId: "gridContent");
 
        @grid1.GetHtml(mode: WebGridPagerModes.All, tableStyle: "webGrid",
            headerStyle: "header",
            alternatingRowStyle: "alt",
            selectedRowStyle: "select",
            rowStyle: "description",
            htmlAttributes: new { id = "positionGrid" },
            fillEmptyRows: false,
 
            columns: grid1.Columns(
 
             grid1.Column("EmployeeId", header: "EmployeeId"),
             grid1.Column("EmpName", header: "EmpName"),
             grid1.Column("Age", header: "Age"),
             grid1.Column("Salary", header: "Salary"),
             grid1.Column("Notes",format: (item) => Html.TextArea("Notes", (string)item.Notes, new { @class = "" }), header: "Notes")))
            }
            </div>   
        </td>
    </tr>
</table>

The format parameter of the Column method allows you to customize the rendering of a item. In the last column of the webgrid format paramter render the data of the item into the textarea.

Controller:

using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication1.Models;
 
namespace MvcApplication1.Controllers
{
    public class EmployeeController : Controller
    {
        private EmployeeDatabaseEntities1 db = new EmployeeDatabaseEntities1();
 
        //
        // GET: /Employee/
 
        public ActionResult Index()
        {
            Employee _model = new Employee();
 
            var qq = (from e in db.tbl_Employee
                      select new Employee
                      {
                          Department_id = e.Department_id,
                          EmployeeId = e.EmployeeId,
                          EmpName = e.EmpName,
                          Age = e.Age,
                          Salary = e.Salary,
                          Notes = e.Notes 
                      }).ToList();
 
            _model.Employee_Grid = qq;
            return View("Index", _model);
        }
    }
}