protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { int madv = int.Parse(Request.QueryString["dv"]); WeeklyReportDAO wr = new WeeklyReportDAO(); lblDate.Text = DateTime.Now.ToString("dd-MM-yyyy"); grDS.DataSource = wr.ListWRDonViBH(madv); grDS.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { HttpCookie ck = Request.Cookies["MaGDV"]; if (ck == null) Response.Redirect("~/Pages/Login.aspx"); else { WeeklyReportDAO wrdao = new WeeklyReportDAO(); gvDSWR.DataSource = wrdao.DanhSachWRAll(); gvDSWR.DataBind(); } } }
protected void gvDSWR_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Update") { GridViewRow row = gvDSWR.SelectedRow; if (row != null) { WeeklyReportDAO wr = new WeeklyReportDAO(); string temp = row.Cells[1].Text; //int ma = int.Parse(gvDSWR.DataKeys[e.RowIndex].Value.ToString()); //int idwr= wr.l int idwr = int.Parse(temp.ToString()); Session["MaWR"] = idwr; Response.Redirect("~/Pages/WeeklyReport.aspx?viewidwr=" + idwr); } else Response.Write("<script> alert ('Weekly report này đã bị xóa hoặc không tồn tại!');</script>"); } }
void loadDS() { WeeklyReportDAO wrdao = new WeeklyReportDAO(); gvDSWR.DataSource = wrdao.DanhSachWRAll(); gvDSWR.DataBind(); }