[asp.net c#] Grid view populated with a list objects as Data Source. Button field that has a link to a file in another directory. Doesn’t seem to be working for me, would appreciate any help.

Hi All,

What I'm looking to accomplish is to allow the user to download a file that is stored in the directory. Would appreciate any help, thank you.

like so. http://ift.tt/1NjC1qb

another attempt http://ift.tt/1Ldb7dr

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DataModels; using System.IO; using System.Data;

namespace RecruiterWebsite { public partial class WebForm12 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e){

 Employer Emp = new Employer(); string Sesh = string.Empty; Sesh = Session["EmployerID"].ToString(); int SessionEmployerID = int.Parse(Sesh); List<JobApplication> Application = new List<JobApplication>(); BLL.BLLRecruiterWebsiteManager RequestJobApplicant = new BLL.BLLRecruiterWebsiteManager(); Application = RequestJobApplicant.GetApplicationsFormDatabase(SessionEmployerID); GridView1.DataSource = Application; GridView1.DataBind(); List<Job> JobList = new List<Job>(); BLL.BLLRecruiterWebsiteManager RequestJobList = new BLL.BLLRecruiterWebsiteManager(); JobList = RequestJobList.ListJobs(SessionEmployerID); GridView2.DataSource = JobList; GridView2.DataBind(); } protected void btnCreateJob_Click(object sender, EventArgs e) { Response.Redirect("~/CreateJob.aspx"); } protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { Response.Write(e.CommandArgument); // Response.Write("Well Shite head"); Download(); } protected void Download() { } } 



<h3>List of Applicants who have applied:</h3> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" CssClass="table" OnRowCommand="GridView1_RowCommand"> <Columns> <asp:ButtonField ButtonType="Button" DataTextField="UploadCvPath" DataTextFormatString="~/Uploads/{0}" Text="Button" CommandName="Download" HeaderText="Download CV" /> </Columns> <PagerSettings Mode="Numeric" Position="Bottom" PageButtonCount="3" /> <PagerStyle BackColor="LightBlue" Height="30px" VerticalAlign="Bottom" HorizontalAlign="Center" /> 


by Tiddleywanksofcum via /r/csharp

Leave a Reply