How to add image to ir.
protected void PrintGridView(object sender, EventArgs e)
{
//Disable Paging if all Pages need to be Printed.
if ((sender as Button).CommandArgument == "All")
{
//Disable Paging.
gvDetails.AllowPaging = false;
//Re-bind the GridView.
this.BindData(string.Empty, string.Empty);
//For Printing Header on each Page.
gvDetails.UseAccessibleHeader = true;
gvDetails.HeaderRow.TableSection = TableRowSection.TableHeader;
gvDetails.FooterRow.TableSection = TableRowSection.TableFooter;
gvDetails.Attributes["style"] = "border-collapse:separate";
foreach (GridViewRow row in gvDetails.Rows)
{
if ((row.RowIndex + 1) % gvDetails.PageSize == 0 && row.RowIndex != 0)
{
row.Attributes["style"] = "page-break-after:always;";
}
}
}
else
{
//Hide the Pager.
gvDetails.PagerSettings.Visible = false;
this.BindData(string.Empty, string.Empty);
}
using (StringWriter sw = new StringWriter())
{
//Render GridView to HTML.
HtmlTextWriter hw = new HtmlTextWriter(sw);
gvDetails.RenderControl(hw);
//Enable Paging.
gvDetails.AllowPaging = true;
this.BindData(string.Empty, string.Empty);
//Remove single quotes to avoid JavaScript error.
string gridHTML = sw.ToString().Replace(Environment.NewLine, "");
//string gridCSS = gridStyles.InnerText.Replace("\"", "'").Replace(Environment.NewLine, "");
//Print the GridView.
//string script = "window.onload = function() { PrintGrid('" + gridHTML + "', '" + gridCSS + "'); }";
string script = "window.onload = function() { PrintGrid('" + gridHTML + "', ''); }";
ClientScript.RegisterStartupScript(this.GetType(), "GridPrint", script, true);
}
}
I've Above Code Copied From (ASPFORUMS) But But But
I Need To Add These Below Two Lines In The Above Code. How Can I Do That. Please Help.
string imgurl = "assets/img/5m-transparent-logo.png";
sb.Append(string.Format("<img id='SpeIma' src='{0}' style='width: 200px; height: 68px; margin-bottom:25px;' />", ResolveUrl(imgurl)));