We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Grid id

Thread ID:

Created:

Updated:

Platform:

Replies:

130118 Apr 23,2017 09:33 AM Apr 24,2017 01:33 PM ASP.NET MVC 1
loading
Tags: Grid
BERNARD
Asked On April 23, 2017 09:33 AM

Hye
I d like To know how display a grid in partial view with a param id from index view .
Exemple
I ve for tasks from customer Id=5 and want To display this tasks in a customer details view  with a partial tasks view 

Thks 
Bernard 

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On April 24, 2017 01:33 PM

Hi Bernard, 

Thanks for your interest in syncfusion supports. 

We have analyzed your query and rendered the Grid in partialView as given below.  In the grid, while on rowselection we have rendered the details of that selectedRow using “RowSelected” event of the Grid. In this event, using args.EmployeeID we have displayed the details of the row in partialView. 
  
Please refer to the code example 


Index.cshtml 
<body> 
@(Html.EJ().Grid<EmployeeView>("MasterGrid") 
        .Datasource((IEnumerable<object>)ViewBag.datasource1) 
        .IsResponsive() 
        .SelectedRowIndex(0) 
        .Columns(col => 
        { 
            col.Field("EmployeeID").HeaderText("Employee ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(100).Add(); 
            col.Field("FirstName").HeaderText("First Name").Width(100).Add(); 
            col.Field("LastName").HeaderText("Last Name").Width(100).Priority(2).Add(); 
            col.Field("Title").HeaderText("Title").Width(90).Priority(3).Add(); 
            col.Field("BirthDate").HeaderText("Birth Date").TextAlign(TextAlign.Right).Width(100).Format("{0:MM/dd/yyyy}").Priority(5).Add(); 
            col.Field("Country").Width(100).HeaderText("Country").Priority(4).Add(); 
 
        }) 
        .ClientSideEvents(eve => { eve.RowSelected("rowSelected"); }) 
    ) 
 
     
</body> 
 
<script type="text/javascript"> 
    $(function () { 
        window.rowSelected = function (args) { 
            var employeeID = args.data.EmployeeID; 
            $.ajax 
                ({ 
                    url: "/Home/EditPartial?OrderID=" + EmployeeID, 
                    type: 'GET', 
                    success: function (data) { 
                        $("#MasterGrid ").html(data);                    } 
                }); 
          } 
    }); 
</script> 
  @Html.EJ().ScriptManager()  @*To render Syncfusion controls in partialview*@ 
   
 
Controller.cs 
 
 [HttpGet] 
        public ActionResult EditPartial() 
        { 
            var DataSource = OrderRepository.GetAllRecords(); 
            var id = 0; 
            Dictionary<string, string>dictionary = new Dictionary<string, string>(); 
            if (Request.QueryString["EmployeeID"] != null) 
            var detaildata = ej.DataManager(window.gridData).executeLocal(ej.Query().where("EmployeeID", ej.FilterOperators.equal, employeeID, false).take(10)); 
            var gridObj = $("#DetailGrid").ejGrid("instance"); 
            var data= gridObj.dataSource(ej.DataManager(detaildata.slice(0, 5))); 
            ViewBag.datasource = data; 
            return PartialView("_PartialPage1", data); 
        } 
 
Please  get back to us if you need any further assistance. 
 
Regards, 
 
Farveen sulthana T 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;