0% found this document useful (0 votes)
7 views1 page

Image Download 4m Server

The document provides a code snippet for handling a row command event in a GridView to facilitate image downloading from a server. When the 'View' command is triggered, it retrieves the candidate's resume file from the database and initiates a download response. If no file is found, it returns a message indicating that no files are available.

Uploaded by

openaryamails
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Image Download 4m Server

The document provides a code snippet for handling a row command event in a GridView to facilitate image downloading from a server. When the 'View' command is triggered, it retrieves the candidate's resume file from the database and initiates a download response. If no file is found, it returns a message indicating that no files are available.

Uploaded by

openaryamails
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Image download from server........

// first bind grid view


and place a command button in gridview... generate row command event and write code
here.......

protected void gv_apply_job_RowCommand(object sender, GridViewCommandEventArgs e)


{
if (e.CommandName == "View")
{
string root = "~/resume/";
int id =
Convert.ToInt32(gv_apply_job.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())
].Value);
objaj.query = "select Candidate_id,Resume from Tbl_Apply_Job where
Candidate_id=" +id.ToString()+ "";
objaj.select(objaj.query);
if (objaj.dr.Read())
{
string fname = objaj.dr[1].ToString();
string fpath = root + fname;
if (fname != "")
{
Response.Clear();
Response.ContentType = "";
Response.AddHeader("content-disposition",
"attachment;filename=" + fname);
Response.WriteFile(fpath);

}
else
{
Response.Write("no files");
}
Response.End();
}
objaj.dr.Close();
}

You might also like