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. Image for the cookie policy date

How to print the Grid using external button in ASP.NET MVC Grid

I would like to print a grid with the same characteristic as ToolbarSettings.
However, I want to leave the grid toolBar hidden and print the grid by clicking another button.

Can you help me perform this functionality?

Kind Regards


1 Reply

DR Dhivya Rajendran Syncfusion Team March 30, 2018 04:43 AM

Hi Carlos, 
Thanks for contacting Syncfusion support. 
We have validated your requirement. We have create a sample for your reference. In the below sample we have to print the grid by using external button. Kindly please refer the below sample and code snippet for more information. 
   @Html.EJS().Button("printbtn").Content("Print").IsPrimary(true).Render() // render button 
   @Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col => 
    col.Field("ShipName").HeaderText("Ship Name").Width("150").Add(); 
    col.Field("ShipCountry").HeaderText("Ship Country").Width("150"). Add(); 
document.getElementById('printbtn').onclick = function () { 
  document.getElementById('Grid').ej2_instances[0].print() // use print() method to print the Grid 

Live Chat Icon For mobile
Up arrow icon