Click here to Skip to main content
13,086,019 members (83,668 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hii to all,
   I Have a requirement that i need to retrive  one r more table's data from DataBase (SQLServer)& display in a Jqgrid.Up to here i have done using Linq Joins&EntityFramework,and one more requirement where i strucked is,here in Jqgrid i have made Multiselect to True,after displaying the table data in Jqgrid the respective checked row's data i need to get in another view say Editable view where i need to dispaly this row data in Textboxes in Editable mode,here user will update the records present in Textboxes and when he press Updata button,the records should be updated to DataBase& also we need to redirect to previous View(after clicking update button in Editable View)
 i.e Jqgrid view & display the modified records in Jqgrid.
Here is my Jqgrid View code  say "GetTablesData":-
@model MVCLINQJoins.Models.TableData
<link href="@Url.Content("~/Content/themes/base/ui.jqgrid.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/JS/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/JS/jquery.jqGrid.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/JS/grid.locale-en.js")" type="text/javascript"></script>
    ViewBag.Title = "GetTablesData";
<script type="text/javascript">
    var mdata = []
@foreach (var item in Model.getEmployeeDetails)
    <script type="text/javascript">
        row = { EmployeeID: '@item.EmployeeId', EmpName: '@item.EmpName', Designation: '@item.Designation', Salary: '@item.Salary', MobileNo: '@item.MobileNo', Email: '@item.Email' };
<table id="emp-data-grid">
<script type="text/javascript">
        datatype: "local",
        data: mdata,
        colNames: ["EmployeeID", "EmpName", "Designation", "Salary", "MobileNo", "Email"],
        colModel: [
                { name: "EmployeeID", index: "EmployeeID", editable: true, edittype: "checkbox", editoptions: { value: "Yes:No"} },
                { name: "EmpName", index: "EmpName" },
                { name: "Designation", index: "Designation" },
                { name: "Salary", index: "Salary", sorttype: "int" },
                { name: "MobileNo", index: "MobileNo", sorttype: "int" },
                { name: "Email", index: "Email" }
        shrinkToFit: true,
        caption: "Employee List"

    @Html.ActionLink("EDIT", "Edit")
when he click on above Edit link,i need to get the respective rows data to Edit View.
Here is My Controller Code:-
public ActionResult GetTablesData()
            TableData model = new TableData();
            model.getEmployeeDetails = new List<Employee>();
            return View(model);
        private static void GetDataFromDB(TableData model)
            using (personalEntities2 db = new personalEntities2())
                var emply = (from empd in db.empdetails
                             join empp in db.emppersonals on empd.empid equals empp.empid
                             orderby empd.empid
                             select new
                foreach (var item in emply)
                    Employee ed = new Employee();
                    ed.EmployeeId = item.empid;
                    ed.EmpName = item.ename;
                    ed.Designation = item.designation;
                    ed.Salary = item.salary;
                    ed.DeptNo = item.deptno;
                    ed.MobileNo = item.mobileno;
                    ed.Email =;
        public ActionResult Edit(Employee model,int id)
          return View(model);
Please guide me how to achieve my requirement along with Controller code.Thanks in advance
Posted 22-May-13 22:06pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100