I have to download pdf file using link button that is binded with grid view. I have uploaded pdf into database table as in varbinary format. The given below table cad_file column contains pdf files. While clicking "version_no" drop down list, I have to bind pdf and all other datas with gridview. And by click on that I want to download pdf. How can I do that. Help me to find a proper solution. Thank you.

Code:

protected void ddlVersionNo_SelectedIndexChanged(object sender, EventArgs e)
    {
        ShadingAnalysisDataSetTableAdapters.tbl_CadFileUploadTableAdapter cd;
        cd = new ShadingAnalysisDataSetTableAdapters.tbl_CadFileUploadTableAdapter();
        DataTable dt = new DataTable();
        dt = cd.GetGvCad2(ddlSiteID.SelectedValue, int.Parse(ddlVersionNo.SelectedValue));
        gvCadPdf.DataSource = dt;
        gvCadPdf.DataBind();
    }

SQL:

SELECT Id, District, SiteName, Site_ID, Created_Date, Created_By, State, Updated_Date, Updated_By, Version_Status, Version_No, Cad_File, Cad_File_Name FROM tbl_CadFileUpload WHERE (Site_ID = @Site_ID) AND (Version_No = @Version_No)

ASPX:

enter image description here

enter image description here

DB:

enter image description here

ScreenShot1:

enter image description here

ScreenShot2:

enter image description here

Related posts

Recent Viewed