Plz solve this error.
CS0104: Color is an ambiguous reference between System.Drawing.Color and iTextSharp.text.Color
Code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.html.simpleparser;
public partial class Server_Admin_Printresult : System.Web.UI.Page
{
//server=204.93.174.60;user id=aster_medical2013;password=jagannath78;database=aster_rxexperience
SqlConnection con = new SqlConnection("Data Source=STAR-PC;Initial Catalog=nursingboard;Integrated Security=True");
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Table"] != null)
{
DataTable dt = (DataTable)Session["Table"];
GridView1.DataSource = dt;
GridView1.DataBind();
HighlightDuplicate(this.GridView1);
}
}
public void HighlightDuplicate(GridView grv)
{
//use the currentRow to compare against
for (int currentRow = 0; currentRow < grv.Rows.Count - 1; currentRow++)
{
GridViewRow rowToCompare = grv.Rows[currentRow];
//specify otherRow as currentRow + 1
for (int otherRow = currentRow + 1; otherRow < grv.Rows.Count; otherRow++)
{
GridViewRow row = grv.Rows[otherRow];
bool duplicateRow = true;
//compare cell rollno between the two rows
if (rowToCompare.Cells[2].Text != row.Cells[2].Text)
{
duplicateRow = false;
//break;
}
//highlight both the currentRow and otherRow if rollno matches
if (duplicateRow)
{
rowToCompare.BackColor = Color.Red;
rowToCompare.ForeColor = Color.Black;
row.BackColor = Color.Red;
row.ForeColor = Color.Black;
//Button1.Visible = false;
}
else
{
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "duplicatereport.xls"));
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.AllowPaging = false;
//Change the Header Row back to white color
GridView1.HeaderRow.Style.Add("background-color", "#FFFFFF");
//Applying stlye to gridview header cells
for (int i = 0; i < GridView1.HeaderRow.Cells.Count; i++)
{
GridView1.HeaderRow.Cells[i].Style.Add("background-color", "#507CD1");
}
int j = 1;
//This loop is used to apply stlye to cells based on particular row
foreach (GridViewRow gvrow in GridView1.Rows)
{
if (j <= GridView1.Rows.Count)
{
if (j % 2 != 0)
{
for (int k = 0; k < gvrow.Cells.Count; k++)
{
gvrow.Cells[k].Style.Add("background-color", "#EFF3FB");
}
}
}
j++;
}
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Duplicaterecord.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridView1.AllowPaging = false;
GridView1.DataBind();
GridView1.RenderControl(hw);
GridView1.HeaderRow.Style.Add("width", "15%");
GridView1.HeaderRow.Style.Add("font-size", "10pt");
GridView1.Style.Add("text-decoration", "none");
GridView1.Style.Add("font-family", "Arial, Helvetica, sans-serif;");
GridView1.Style.Add("font-size", "8pt");
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A2, 7f, 7f, 7f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}
}