Click here to Skip to main content
14,635,966 members
Rate this:
Please Sign up or sign in to vote.
See more:
I'm exporting multiple gridview to PDF,I wanna color for grid header.I tried in Html page and code behind but its not working the fore color and font were changing except this background color.


I worked like this
<asp:GridView ID="DataListStatename" runat="server" Width="100%" EmptyDataText="No Records Found" AutoGenerateColumns="false" ShowHeader="true">
<headerstyle backcolor="#C0C0C0"
forecolor="MediumBlue"/>
<columns> <asp:BoundField DataField="VERSIONS" HeaderText="VERSIONS" Visible="false"/>
<asp:BoundField DataField="COM_NAME" HeaderText="COMPONENT NAME"/>
<asp:BoundField DataField="INITIALIZED_DATE" HeaderText="INITIATED DATE" />
<asp:BoundField DataField="PDV_NEW_MATERIAL_CODE" HeaderText="NEW MATERIAL CODE" />
<asp:BoundField DataField="PDV_OLD_MATERIAL_CODE" HeaderText="OLD MATERIAL CODE" />
<asp:BoundField DataField="PDV_FINALIZED_DATE" HeaderText="FINALIZED DATE"/>
<asp:BoundField DataField="STATUS" HeaderText="STATUS" />




DataListStatename.DataSource = dt1.Tables[0];
DataListStatename.DataBind();
DataListStatename.HeaderStyle.BackColor= Color.Green;//this is not working
// DataListStatename.HeaderStyle.ForeColor = Color.Green;//this were working
// DataListStatename.Style.Add("font-size", "40px");//this were working
DataListProductInformation.DataSource = dt1.Tables[7];
DataListProductInformation.DataBind();

result = ("
Artwork History<asp:image ID='Image1' ImageUrl='~/Images/Goose Logo1.png' runat='server'>
");
hw.Write(result);
bindpdf.RenderControl(hw);

// hw.Write();
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}


Plz any one give me the suggestion .
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Comments
Usha Sanjee 5-Aug-14 6:47am
   
Thnks, But i dnt wanna go for iTextsharp.thats the problem. My doubt is why background style is not applying when all other styles are working there.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100