Hello Team,
i am new to dxhtml.
i do have a requiremnet to export the grid data in PDF format.
I do not want to use MVC patten in my project.
i do have code following thing.
design:
<input type="button" name="" value="Generate PDF" style="width: 300px; font-weight: bold;"
[b] onclick="mygrid.toPDF('/PDF);"><[/b]br><br>
</div>
<script>
var mygrid;
function doInitGrid() {
mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setHeader("Model,Qty,Price");
mygrid.setInitWidths("*,150,150");
mygrid.setColAlign("left,right,right");
mygrid.setSkin("light");
mygrid.setColSorting("str,int,na");
mygrid.init();
mygrid.loadXML("data.xml");
}
my .ashx file code.
public void ProcessRequest(HttpContext context)
{
var writer = new PDFWriter();
context.Response.ContentType = writer.ContentType;
context.Response.HeaderEncoding = System.Text.Encoding.UTF8;
context.Response.AppendHeader("Content- Disposition", "attachment;filename=grid.pdf");
context.Response.AppendHeader("Cache-Control", "max-age=0");
var xml = context.Request.Form["grid_xml"];
xml = context.Server.UrlDecode(xml);
var stream = writer.Generate(xml);
stream.WriteTo(context.Response.OutputStream);
context.Response.End();
}
i do have below issue.
I am not able to use the myGrid.toPDF function properly.
I am getting the below error.
Microsoft JScript runtime error: Object doesn’t support property or method ‘toPDF’
I am using the latest grid.net.pdf version and using the .net version 4.0
so do need a help to genarete the PDF using .net.
Please suggest your views on same.
Thanks
Ajay