kats9993 says:
<asp:GridView ID="GridView1" Style="margin: auto" runat="server" AutoGenerateColumns="False"
OnRowDataBound="GridView1_RowDataBound" BackColor="White" BorderColor="#CCCCCC"
BorderStyle="None" BorderWidth="1px" Width="690px" CellPadding="4" ForeColor="Black"
GridLines="Horizontal" >
<Columns>
<asp:BoundField DataField="PId_Num" Visible="false" />
<asp:BoundField DataField="SrNo" Visible="false" />
<asp:BoundField DataField="AcYear" Visible="false" />
<asp:BoundField DataField="Comp_Code" Visible="false" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText = "Product's Certificates Details" >
<ItemTemplate>
<asp:Literal ID="ltEmbed" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#4B4B4B" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#242121" />
</asp:GridView>
replace above with below code
<asp:GridView ID="GridView1" Style="margin: auto" runat="server" AutoGenerateColumns="False"
OnRowDataBound="GridView1_RowDataBound" BackColor="White" BorderColor="#CCCCCC"
BorderStyle="None" BorderWidth="1px" Width="690px" CellPadding="4" ForeColor="Black"
GridLines="Horizontal">
<Columns>
<asp:BoundField DataField="PId_Num" Visible="false" />
<asp:BoundField DataField="SrNo" Visible="false" />
<asp:BoundField DataField="AcYear" Visible="false" />
<asp:BoundField DataField="Comp_Code" Visible="false" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Product's Certificates Details">
<ItemTemplate>
<iframe id="ifDisplayPdf" runat="server"></iframe>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#4B4B4B" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#242121" />
</asp:GridView>
kats9993 says:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string
embed = "<object data=\"{0}{1}\" type=\"application/pdf\" width=\"690px\" height=\"500px\">";
embed += "If you are unable to view file, you can download from <a href = \"{0}{1}&download=1\">here</a>";
embed += "</object>";
System.Data.DataRowView DataRowView_1 = (System.Data.DataRowView)e.Row.DataItem;
String PId_Num_String = Val.To_String(Val.To_Int(DataRowView_1["PId_Num"]));
String SrNo_String = Val.To_String(Val.To_Int(DataRowView_1["SrNo"]));
String AcYear_String = Val.To_String(Val.To_Int(DataRowView_1["AcYear"]));
String Comp_Code_String = Val.To_String(Val.To_String(DataRowView_1["Comp_Code"]));
(e.Row.FindControl("ltEmbed") as Literal).Text = string.Format(embed, ResolveUrl("~/File.ashx"), "?PN=" + PId_Num_String + "&SN=" + SrNo_String + "&AC=" + AcYear_String + "&CC=" + Comp_Code_String);
}
}
replace above with below
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
System.Data.DataRowView DataRowView_1 = (System.Data.DataRowView)e.Row.DataItem;
String PId_Num_String = Val.To_String(Val.To_Int(DataRowView_1["PId_Num"]));
String SrNo_String = Val.To_String(Val.To_Int(DataRowView_1["SrNo"]));
String AcYear_String = Val.To_String(Val.To_Int(DataRowView_1["AcYear"]));
String Comp_Code_String = Val.To_String(Val.To_String(DataRowView_1["Comp_Code"]));
(e.Row.FindControl("ifDisplayPdf") as System.Web.UI.HtmlControls.HtmlControl).Attributes["src"] = ResolveUrl("~/File.ashx?PN=" + PId_Num_String + "&SN=" + SrNo_String + "&AC=" + AcYear_String + "&CC=" + Comp_Code_String);
}
}