Hi Sheo,
I followed one of your article
http://www.dotnetfunda.com/articles/article977-pdf-generator-in-net-dynamically-generate-pdf-in-aspnet.aspx?com=added
http://www.dotnetfunda.com/articles/article1150-all-in-one-export-data-in-aspnet-gridview-to-doc-gridview-to-excel-gr.aspx
I am exporting a grid view to PDF using above code in web part,in web part or user control i am not able to write
public override void VerifyRenderingInServerForm(Control control)
{
}
so i used htmlform like this
using (StringWriter sWriter = new StringWriter(strB))
{
using (HtmlTextWriter htWriter = new HtmlTextWriter(sWriter))
{
using (HtmlForm frm = new HtmlForm())
{
GridView1.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(GridView1);
frm.RenderControl(htWriter);
// GridView1.RenderControl(htWriter);
}
}
}
After exporting to PDF some unwanted headers are adding which are not required above and below of the content.I followed different URLs.some of the codes are working good in asp.net webpages.
Because in that pages i am able to write the below method which i can't write in webpart or usercontrol.
Please find this attachment,please help me.This type of headers are adding above and below the code. I think this is top and bottom of the page.i am not sure about that.
//var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function
__doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit(); } } ////var MSOWebPartPageFormName = 'aspnetForm'; var g_presenceEnabled = true;
var g_wsaEnabled = false; var g_wsaLCID = 1033; var g_wsaSiteTemplateId = 'STS#0'; var
g_wsaListTemplateId = 850; var _fV4UI=true;var _spPageContextInfo = {webServerRelativeUrl: "\u002f",
webLanguage: 1033, currentLanguage: 1033, webUIVersion:4,pageListId:"{12e3d35a-1bde-402c-910af18ab0398d16}",
pageItemId:1,userId:2, alertsEnabled:true, siteServerRelativeUrl: "\u002f",
allowSilverlightPrompt:'True'};////var dlc_fvsi = {"DefaultViews":[],"ViewUrls":[],"WebUrl":"\/"};////function
_spNavigateHierarchy(nodeDiv, dataSourceId, dataPath, url, listInContext, type) {
CoreInvoke('ProcessDefaultNavigateHierarchy', nodeDiv, dataSourceId, dataPath, url, listInContext, type,
document.forms.aspnetForm, "", "\u002fPages\u002fReportTool.aspx"); } ////function WebForm_OnSubmit()
{ UpdateFormDigest('\u002f', 1440000); return true; } //
Please help me getting this.
Thanks in advance.
Regards,
Bhanu
Regards,
Bhanu Prakash Bysani