public void HideControls(ContentPlaceHolder cnt, System.Web.UI.Page pg) { string pagename = HttpContext.Current.Request.Url.AbsolutePath.ToLower().Replace("/", "").Replace(".aspx", "").ToString(); string controllist = ""; switch (pagename) { case "show": { controllist = "pnlshow"; break; } case "personal": { controllist = "pnlpersonal"; break; } case "presenter": { controllist = "pnlpresenter"; break; } case "metro": { controllist = "pnlmetro"; break; } case "venue": { controllist = "pnlvenue"; break; } } Panel ctl = (Panel)cnt.FindControl(controllist); if (ctl != null) { ctl.Enabled = false; } //for (int i = 0; i < controllist.Split(',').Length; i++) //{ // //System.Web.UI.Control ctl =(System.Web.UI.Control) cnt.FindControl(controllist.Split(',')[i]); // Panel ctl = (Panel)cnt.FindControl(controllist.Split(',')[i]); // if (ctl != null) // { // ctl.Enabled = false; // } //} }
// Initialize controls public override void InitShadow(System.Web.UI.WebControls.ContentPlaceHolder oContentPage) { #region begin lblSite = (Hidden)oContentPage.FindControl("lblSite"); lblBu = (Hidden)oContentPage.FindControl("lblBu"); lblBuilding = (Hidden)oContentPage.FindControl("lblBuilding"); txtFormNo = (TextField)oContentPage.FindControl("txtFormNo"); txtCustomer = (TextField)oContentPage.FindControl("txtCustomer"); txtDate = (TextField)oContentPage.FindControl("txtDate"); txtNotes = (TextArea)oContentPage.FindControl("txtNotes"); cmbPhase = (ComboBox)oContentPage.FindControl("cmbPhase"); cmbPlant = (ComboBox)oContentPage.FindControl("cmbPlant"); cbProductType = (ComboBox)oContentPage.FindControl("cbProductType"); txtModel = (TextField)oContentPage.FindControl("txtModel");; cmbLayout = (MultiCombo)oContentPage.FindControl("cmbLayout");; txtPM = (TextField)oContentPage.FindControl("txtPM"); txtRD = (TextField)oContentPage.FindControl("txtRD"); txtSales = (TextField)oContentPage.FindControl("txtSales"); txtNextStage_BeginDate = (DateField)oContentPage.FindControl("txtNextStage_BeginDate"); ConAttachment = (Container)oContentPage.FindControl("ConAttachment"); cmbPM = (ComboBox)oContentPage.FindControl("cmbPM"); cmbRD = (ComboBox)oContentPage.FindControl("cmbRD"); cmbSales = (ComboBox)oContentPage.FindControl("cmbSales"); txtPMExt = (NumberField)oContentPage.FindControl("txtPMExt"); txtRDExt = (NumberField)oContentPage.FindControl("txtRDExt"); txtSalesExt = (NumberField)oContentPage.FindControl("txtSalesExt"); pnlCountersign = (Panel)oContentPage.FindControl("pnlCountersign"); grdResult = (GridPanel)oContentPage.FindControl("grdResult"); btnDelete = (Button)oContentPage.FindControl("btnDelete"); cmbAttachmentType = (ComboBox)oContentPage.FindControl("cmbAttachmentType"); btnDelete = (Button)oContentPage.FindControl("btnDelete"); grdAttachment = (GridPanel)oContentPage.FindControl("grdAttachment"); pnlResult = (Panel)oContentPage.FindControl("pnlResult"); rgResult = (RadioGroup)oContentPage.FindControl("rgResult"); txtReslutOpinion = (TextArea)oContentPage.FindControl("txtReslutOpinion"); rdResultY = (Radio)oContentPage.FindControl("rdResultY"); rdResultN = (Radio)oContentPage.FindControl("rdResultN"); rdReulutCondition = (Radio)oContentPage.FindControl("rdReulutCondition"); #endregion }
public void usercontrollist(string ucname, ContentPlaceHolder uc_cnt, string uc_list) { string[] arr = uc_list.Split(','); System.Web.UI.Control uc = (System.Web.UI.Control)uc_cnt.FindControl(ucname); for (int i = 0; i < arr.Length; i++) { uc.FindControl(arr[i]).Visible = false; } }
// Initialize controls public override void InitShadow(System.Web.UI.WebControls.ContentPlaceHolder oContentPage) { #region Begin vMain = (Panel)oContentPage.FindControl("vMain"); pnlMain = (Panel)oContentPage.FindControl("pnlMain"); frmUserInfo = (Panel)oContentPage.FindControl("frmUserInfo"); frmApplyInfo = (Panel)oContentPage.FindControl("frmApplyInfo"); //基本資料 txtLogonID = (TextField)oContentPage.FindControl("txtLogonID"); txtName = (TextField)oContentPage.FindControl("txtName"); txtPlant = (TextField)oContentPage.FindControl("txtPlant"); txtDept = (TextField)oContentPage.FindControl("txtDept"); txtEMail = (TextField)oContentPage.FindControl("txtEMail"); txtExtNO = (TextField)oContentPage.FindControl("txtExtNO"); //單據資料 txtRDocNo = (TextField)oContentPage.FindControl("txtRDocNo"); btnLink = (Button)oContentPage.FindControl("btnLink"); txtDocNo = (TextField)oContentPage.FindControl("txtDocNo"); txtCostCenter = (TextField)oContentPage.FindControl("txtCostCenter"); txtDepartment = (TextField)oContentPage.FindControl("txtDepartment"); txtApplication = (TextField)oContentPage.FindControl("txtApplication"); txtMaterial = (ComboBox)oContentPage.FindControl("txtMaterial"); txtReturnQuantity = (TextField)oContentPage.FindControl("txtReturnQuantity"); txtReason = (ComboBox)oContentPage.FindControl("txtReason"); txtRemark = (TextArea)oContentPage.FindControl("txtRemark"); txtReturn = (TextField)oContentPage.FindControl("txtReturn"); txtIADocNo = (TextField)oContentPage.FindControl("txtIADocNo"); txtI6DocNo = (TextField)oContentPage.FindControl("txtI6DocNo"); txtZEILE = (TextField)oContentPage.FindControl("txtZEILE"); txtAmount = (TextField)oContentPage.FindControl("txtAmount"); //SOURCE DATA txtHead = (TextField)oContentPage.FindControl("txtHead"); txtDOA = (TextField)oContentPage.FindControl("txtDOA"); txtDetail = (TextField)oContentPage.FindControl("txtDetail"); txtWERKS = (TextField)oContentPage.FindControl("txtWERKS"); txtAPTYP = (TextField)oContentPage.FindControl("txtAPTYP"); #endregion }