I am working on a website. In this, I have to display a name of file uploaded by admin(not its file name) as link. when a user click on link, it will open saved file from database(pdf files saved as binary files).
I have used a datalist as-
Width="498px">
and in .cs file code is
protected void Bind_DataList()
{
string strCon = ConfigurationManager.ConnectionStrings["MyDBConnectionString"].ConnectionString.ToString();
SqlConnection con = new SqlConnection(strCon);
con.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from Orders_Table order by ID desc", con);
DataTable dt = new DataTable();
PagedDataSource pd = new PagedDataSource();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
pd.DataSource = dt.DefaultView;
DL_Circular.DataSource = pd;
DL_Circular.DataBind();
}
else
{
DL_Circular.Visible = false;
}
con.Close();
}
I am trying to give a onclick event, that will conver binary to pdf format and open pdf file in new tab. But it fails.
Please help me.
Thank you,

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 19, 2013, 9:22 PM EST
Make that link's target="_blank" & try to set like this,
Response.ContentType = "Application/pdf";
Response.BinaryWrite(pdffilebytes);
Anuradha Chavan29 reputationPosted Nov 19, 2013, 11:07 PM EST
when i run a program resuls that, Failed to load pdf