private void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { string mode = Request.QueryString["Mode"] ?? ""; switch (mode) { case "Insert": try { OperationMode = OpMode.Add; SetControlStatus(); MaintainStoreTransfer bco = new MaintainStoreTransfer(ConnectionDB); string aplDate = bco.GetAPLDate(); txtBusDate.Text = aplDate; ddlACStatus.Text = "1"; } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } break; case "View": try { if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { ViewState["CurrentID"] = Request.QueryString["ID"]; BindData(); } OperationMode = OpMode.View; SetControlStatus(); } catch (Exception ex) { WaringLogProcess(ex.Message); this.ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0]; //直接取第一個 } finally { Finally_Function(); } break; default: break; } } if ((OperationMode == OpMode.Add) || (OperationMode == OpMode.Edit)) { Cal_GV1_Total(); bool bA15 = false; for (int i = 0; i < GridView1.Rows.Count; i++) { if (GridView1.Rows[i].Cells[7].Text.Trim() == "A15") { bA15 = true; break; } } if (bA15 == true) { ddlDesc.ReadOnly = false; } else { ddlDesc.Text = ""; ddlDesc.ReadOnly = true; } } if ((OperationMode == OpMode.Add) || ((ddlACStatus.Text == "1") && (OperationMode == OpMode.Edit))) { ((TextBox)txtSignDate.FindControl("TextBoxCode")).Attributes["onblur"] = "if(vSignDate!=document.getElementById('ctl00_CPH_TabContainer1_TabPanel1_txtSignDate_TextBoxCode').value){vSignDate=document.getElementById('ctl00_CPH_TabContainer1_TabPanel1_txtSignDate_TextBoxCode').value;document.getElementById('" + this.btnReLoad.ClientID + "').click();}"; } }
private void Page_PreRender(object sender, EventArgs e) { string mode = Request.QueryString["Mode"] ?? ""; if (!IsPostBack) { switch (mode) { case "Insert": OperationMode = OpMode.Add; SetControlStatus(OperationMode); MaintainStoreTransfer bco = new MaintainStoreTransfer(ConnectionDB); string aplDate = bco.GetAPLDate(); slpBusDate.Text = aplDate; ddlACStatus.Text = "1"; ddlIOType.Text = ""; txtStore.Focus(); break; case "View": if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { ViewState["CurrentID"] = Request.QueryString["ID"]; BindData(); } if (ddlACStatus.Text != "1") { ButtonModify.Visible = false; } OperationMode = OpMode.View; SetControlStatus(OperationMode); break; default: break; } } if ((OperationMode == OpMode.Add) || ((ddlACStatus.Text == "1") && (OperationMode == OpMode.Edit))) { ((TextBox)slpTransferDate.FindControl("TextBoxCode")).Attributes["onblur"] = "if(vTransferDate!=document.getElementById('ctl00_CPH_TabContainer1_TabPanel1_slpTransferDate_TextBoxCode').value){vTransferDate=document.getElementById('ctl00_CPH_TabContainer1_TabPanel1_slpTransferDate_TextBoxCode').value;document.getElementById('" + this.btnReLoad.ClientID + "').click();}"; } Cal_Summary(); }