ASP MVC GRID PRINT OPTION

Dear Support,
I am using the print option of the grid and I wonder if it is possible to add a text uppon the printed grid (a legend ? )

1 Reply

SE Sathyanarayanamoorthy Eswararao Syncfusion Team July 24, 2018 12:41 PM UTC

Hi Selem, 

Thanks for using Syncfusion products. 

Query : I wonder if it is possible to add a text upon the printed grid  
 
We have achieved your requirement using the beforePrint event of ejGrid control. In the beforePrint event we have prepended the text and image to the grid. Please refer the below code example. 

<div id="ControlRegion">  
    @(Html.EJ().Grid<object>("FlatGrid")  
        .Datasource((IEnumerable<object>)ViewBag.datasource)  
        .AllowPaging()  
                .ToolbarSettings(toolbar =>  
        {  
            toolbar.ShowToolbar().ToolbarItems(items =>  
            {  
                items.AddTool(ToolBarItems.PrintGrid);  
            });  
        })  
        .ClientSideEvents(cevent => cevent.BeforePrint("beforePrint"))  
        .Columns(col =>  
        {  
           ---  
       }))  
</div>  
<label id="lblHeader" class="header" style="display:none;">Navigations</label> 
 
<style type="text/css"> 
    .image{ 
        padding-left:100px; 
    } 
    .header{ 
        font-weight:500; 
        font-size:larger; 
    } 
</style> 
 
<script type="text/javascript" >  
    function beforePrint(args) { 
        $("#lblHeader").css('display', 'block'); 
        args.element.prepend($(".header")); 
    } 
 
</script >  

Please refer the below help documentation. 


We also would like to let you know about our next generation JavaScript product - Essential JS 2, in case if you are not aware of it. Essential JS 2 is fully re-written to be modular, responsive and lightweight. 
 
We suggest you look into our following product page for more details. 
 
 
Demo page for ej2 Grid 
 


If you need any further assistance please get back to us. 

Regards, 
Sathyanarayanamoorthy 



Loader.
Up arrow icon