Show images in GridView using fileUpload and without Database in asp.net C#
you can implement as database also,
here i implement to calculate age using Date of birth bod datepicker
View Part - WebForm1.aspx
Code Part - WebForm1.aspx.cs
protected void Button1_Click(object sender, EventArgs e)
{
string spath = "~/images/" + FileUpload1.FileName;
FileUpload1.SaveAs(Server.MapPath(spath));
DataTable dt = new DataTable();
DataColumn dc1 = new DataColumn("image");
dt.Columns.Add(dc1);
DataRow dr1 = dt.NewRow();
dr1[0] = spath;
dt.Rows.Add(dr1);
GridView1.DataSource = dt;
GridView1.DataBind();
age.Text = (DateTime.Today.Year - Convert.ToDateTime(dob.Text).Year).ToString();
}
you can implement as database also,
here i implement to calculate age using Date of birth bod datepicker
View Part - WebForm1.aspx
Code Part - WebForm1.aspx.cs
protected void Button1_Click(object sender, EventArgs e)
{
string spath = "~/images/" + FileUpload1.FileName;
FileUpload1.SaveAs(Server.MapPath(spath));
DataTable dt = new DataTable();
DataColumn dc1 = new DataColumn("image");
dt.Columns.Add(dc1);
DataRow dr1 = dt.NewRow();
dr1[0] = spath;
dt.Rows.Add(dr1);
GridView1.DataSource = dt;
GridView1.DataBind();
age.Text = (DateTime.Today.Year - Convert.ToDateTime(dob.Text).Year).ToString();
}