public void LoadGridView() { LecturesDAL ldal = new LecturesDAL(); DataSet ds = ldal.GetStudents(); grdStudents.DataSource = ds; grdStudents.DataBind(); }
public void LoadGridView() { LecturesDAL ldal = new LecturesDAL(); string id = Session["Marks_Key"].ToString(); DataSet ds = ldal.GetStudents(id); grdStudents.DataSource = ds; grdStudents.DataBind(); }
public void btnDelete_Click(object sender, EventArgs e) { foreach (GridViewRow row in grdStudents.Rows) { LecturesDAL ldal = new LecturesDAL(); int id = Convert.ToInt32(row.Cells[0].Text); ldal.DeleteStudent(id); Response.Redirect(Request.Url.AbsoluteUri); } }
public void Watch_Click(object sender, EventArgs e) { StringBuilder htmlTable = new StringBuilder(); LecturesDAL ldal = new LecturesDAL(); GridViewRow grdrow = (GridViewRow)((LinkButton)sender).NamingContainer; int id = Convert.ToInt32(grdrow.Cells[0].Text); DataSet ds = ldal.GetVideo(id); DataTable dt = ds.Tables[0]; DataRow dr = dt.Rows[0]; string path = dr["PictureUri"].ToString(); htmlTable.Append(" <iframe width='560' height='315' src='" + path + "' frameborder='0' allowfullscreen></iframe>"); DBDataPlaceHolder.Controls.Add(new Literal { Text = htmlTable.ToString() }); }
protected void AddStdnt_Click(object sender, EventArgs e) { Lectures l = new Lectures(); LecturesDAL ldal = new LecturesDAL(); try { l.LectureName = Request.Form["s_name"].ToString(); l.instructor = Session["Lecture_Key"].ToString(); l.LectureDescription = Request.Form["s_contact"].ToString(); l.instructor_name = Session["User"].ToString(); } catch (Exception) { } l.Id = ldal.AddStudent(l); string filePath = string.Format("images/{0}.{1}", l.Id, s_file.PostedFile.FileName.Substring(s_file.PostedFile.FileName.LastIndexOf('.') + 1)); s_file.SaveAs(Server.MapPath(filePath)); l.PictureUri = filePath; ldal.UpdateStudent(l); LoadGridView(); }