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
close icon

Grid Template column hyperlink printing defect

Hello.
I'm using version 15.40.20.
There's a way in my ID field in the grid as follows.
All url information comes from direct printing.
In pdf and excel printing, the ID field does not appear at all.
How can I solve the problem?

source code is below:

     @(Html.EJ().Grid<object>("PersonelListele")
              .Datasource((IEnumerable<object>)ViewBag.Personel)
              .AllowSorting()
              .AllowPaging()
              .AllowResizing()
              .AllowResizeToFit()
              .CommonWidth(100)
              .ShowColumnChooser()
              .PageSettings(p => { p.PageSize(50); })
              .ClientSideEvents(eve => { eve.DataBound("databound").ActionComplete("actioncomplete").Create("create").ToolbarClick("ToolBarClick"); })
              .ToolbarSettings(toolbar =>
              {
                  toolbar.ShowToolbar().ToolbarItems(items =>
                  {
                      items.AddTool(ToolBarItems.Search);
                      items.AddTool(ToolBarItems.ExcelExport);
                      items.AddTool(ToolBarItems.PdfExport);
                      items.AddTool(ToolBarItems.PrintGrid);
                     
                  });
                  toolbar.CustomToolbarItems(new List<object>() { new Syncfusion.JavaScript.Models.CustomToolbarItem() { TemplateID = "#sifirla" } });
              })

              .ClientSideEvents(eve => eve.BeforePrint("beforePrint").ActionBegin("actionbegin"))
              .Mappers(map => map.ExportToExcelAction(Url.Action("ExportToExcel")).ExportToPdfAction(Url.Action("ExportToPdf")))
              .Columns(col =>
              {
                  bool Primary = true;
                  foreach (var item in (IEnumerable<AllClassController.Kolon>)ViewBag.Kolon)
                  {
                      if (Primary)
                      {
                          col.Field(item.KolonKod).HeaderText(item.KolonAdi).Template("#SistemID").TextAlign(TextAlign.Center).Width(100).IsPrimaryKey(true).Add();
                          Primary = false;
                      }
                      else
                      {
                          col.Field(item.KolonKod).HeaderText(item.KolonAdi).Format("{0:dd/MM/yyyy}").Add();
                      }
                  }
              }))








1 Reply

MP Manivannan Padmanaban Syncfusion Team July 24, 2019 09:58 AM UTC

Hi Tayfun, 

Greetings from Syncfusion Support. 

Query: In pdf and excel printing, the ID field does not appear at all. 
How can I solve the problem? 
 
From the above query we are able to understand that you have facing the issue with hyper link column exporting. To export the grid with columnTemplate we have to set the IsTemplateColumnIncluded as true in the parameter of the export method. We can handle the template elements in server-side event while exporting the grid to various files such as Excel, PDF and Word. We can modify the template column of exporting files using server events. Refer the below help documentation link, 

Also refer the below link for demo, 

Still facing the issue, kindly get back to us with the complete code example of both client and server end. 

Regards, 
Manivannan Padmanaban. 


Loader.
Live Chat Icon For mobile
Up arrow icon