protected void Page_Load(object sender, EventArgs e) { if (Session["username"] != null) { if (!IsPostBack) { Label lbl = (Label)this.Master.FindControl("lblheader") as Label; lbl.Text = "Import Item"; WebForm1 P = new WebForm1(); ViewState["jo"] = P.jo; getdata(); } } else { Response.Redirect("~/AFTERSALESPROJ/LoginPage.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] != null) { if (!IsPostBack) { Session["dataurlsignature"] = ""; Session["inspectedby"] = ""; Session["inspecteddate"] = ""; Session["dataurlsignature1"] = ""; Session["monitoredby"] = ""; Session["monitoreddate"] = ""; Label l = this.Master.FindControl("lblheader") as Label; l.Text = "Reporting"; //Page lastpage = Page.PreviousPage; //if (lastpage is WebForm1) //{ // lblproject.Text = ((WebForm1)lastpage).project; // lbladdress.Text = ((WebForm1)lastpage).address; // lbljo.Text = ((WebForm1)lastpage).jo; // lblprofilefinish.Text = "("+((WebForm1)lastpage).profilefinish+") "; //} WebForm1 p = new WebForm1(); lblproject.Text = p.project; lbladdress.Text = p.address; lbljo.Text = p.jo; lblprofilefinish.Text = "(" + p.profilefinish + ") "; } } else { Response.Redirect("~/AFTERSALESPROJ/LoginPage.aspx"); } }
protected void btnimport_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, Page.GetType(), "Script", "confimmessage();", true); List <int> l = new List <int>(); if ((List <int>)ViewState["listid"] == null) { l.Add(0); } else { l = ViewState["listid"] as List <int>; } foreach (GridViewRow row in GridView1.Rows) { CheckBox cbk = (CheckBox)row.FindControl("cboxselect"); if (cbk.Checked == true) { int x = int.Parse(row.Cells[1].Text.ToString()); if (!l.Contains(x)) { l.Add(x); } } else { int x = int.Parse(row.Cells[1].Text.ToString()); if (l.Contains(x)) { l.Remove(x); } } } try { WebForm1 P = new WebForm1(); for (int i = 0; i <= mytb.Rows.Count - 1; i++) { int id = Convert.ToInt32(mytb.Rows[i]["id"].ToString()); if (l.Contains(id)) { string sid, kno, itemno, location; sid = P.sid; kno = mytb.Rows[i]["kmdi_no"].ToString(); itemno = mytb.Rows[i]["item_no"].ToString(); location = mytb.Rows[i]["location"].ToString(); insertrecord(sid, kno, itemno, location); } } } catch (Exception ex) { Response.Write(ex.ToString()); } finally { ScriptManager.RegisterStartupScript(this, Page.GetType(), "Script", "redirectme();", true); } ViewState["listid"] = l; }