public Control() { if (formSkin == null) formSkin = SharedInformation.ContentManager.Load<Texture2D>(@"data\fb\texture\wndskin.png"); if (gulim8 == null) gulim8 = SharedInformation.ContentManager.Load<SpriteFont>(@"fb\Gulim8.xnb"); if (gulim8B == null) gulim8B = SharedInformation.ContentManager.Load<SpriteFont>(@"fb\Gulim8b.xnb"); if (tingSound == null) tingSound = SharedInformation.ContentManager.Load<SoundEffect>(@"data\wav\버튼소리.wav"); _controls = new ControlCollection(this); _handle = GuiManager.Singleton.GetNewHandle(); _foreColor = Color.Black; _backColor = Color.White; _text = ""; _visible = true; _enabled = true; _tabStop = false; _zorder = 0; _font = Gulim8; }
private void RecurseControls(ControlCollection c) { // Only one of the passed controls will contain all the questions. int i = 0; foreach (Control con in c) { HtmlGenericControl hgc = con as HtmlGenericControl; if (hgc != null && hgc.TagName.ToUpperInvariant() == "H3") { if (hgc.Attributes["class"] == "question") { string id = "q" + i.ToString(); hgc.Attributes.Add("id", id); // Add to TOC HtmlGenericControl tocItem = new HtmlGenericControl("li"); HtmlGenericControl anchor = new HtmlGenericControl("a"); anchor.Attributes.Add("href", "#" + id); anchor.InnerText = hgc.InnerText; tocItem.Controls.Add(anchor); toc.Controls.Add(tocItem); i++; } } this.RecurseControls(con.Controls); } }
/// <summary> /// Add one ControlCollection to another. Combines them into one collection. /// </summary> /// <param name="collection">The collection to merge with this one.</param> public void Add(ControlCollection collection) { foreach(Control control in collection) { Add(control); } }
protected void LoadProperties(string source) { XmlDocument document = new XmlDocument(); document.LoadXml(source); XmlNodeList elementsByTagName = document.GetElementsByTagName("Property"); this.mPropertyDoc = (XmlDocument) document.Clone(); XmlElement element = this.mPropertyDoc.CreateElement("properties"); string str = ""; XmlNode newChild = null; foreach (XmlNode node2 in elementsByTagName) { XmlAttribute namedItem = (XmlAttribute) node2.Attributes.GetNamedItem("control"); if (str != namedItem.Value) { newChild = element.OwnerDocument.CreateElement(namedItem.Value); element.AppendChild(newChild); str = namedItem.Value; } XmlElement element2 = newChild.OwnerDocument.CreateElement("Property"); for (int i = 0; i < node2.Attributes.Count; i++) { element2.SetAttribute(node2.Attributes[i].Name, node2.Attributes[i].Value); } newChild.AppendChild(element2); } this.Controls = new ControlCollection(element.ChildNodes); }
protected void DisplayData(ControlCollection controls) { foreach (KeyValuePair<string, string> item in (Dictionary<string,string>)ViewState["formData"]) { Label1.Text += item.Value + " "; } }
internal TableRowCollection (Table table) { if (table == null) throw new ArgumentNullException ("table"); cc = table.Controls; owner = table; }
//this method clears all the textboxes without actually calling all the seperate values private void ClearInputs(ControlCollection ctrls) { foreach (Control ctrl in ctrls) { if (ctrl is TextBox) ((TextBox)ctrl).Text = string.Empty; ClearInputs(ctrl.Controls); } }
private void SetReadOnly(bool isReadOnly, ControlCollection collection) { foreach (DictionaryEntry dic in DataControlCollection) { IWebDataControl dc = (IWebDataControl)dic.Value; dc.SetReadOnly(isReadOnly); } TxtVersion.SetReadOnly(true); }
public void ClearControls(ControlCollection ctrl) { foreach(Control ctl in ctrl) { if(ctl is TextBox) { (ctl as TextBox).Text = " "; } ClearControls(ctl.Controls); } }
protected CompositeControlBase() { _controls = new ControlCollection(this); _controls.ControlAdded += (sender, args) => ChangeControl(args.Control, true); _controls.ControlRemoved += (sender, args) => ChangeControl(args.Control, false); _controls.ControlsReset += (sender, args) => { args.OldControls.ForEach(c => ChangeControl(c, false)); args.NewControls.ForEach(c => ChangeControl(c, true)); }; }
private void ClearInputs(ControlCollection ctrls) { foreach (Control ctrl in ctrls) { if (ctrl is TextBox) ((TextBox)ctrl).Text = string.Empty; else if (ctrl is DropDownList) ((DropDownList)ctrl).ClearSelection(); ClearInputs(ctrl.Controls); } }
/// <summary> /// Initializes a new instance of the <see cref="Control"/> class. /// </summary> protected Control() { this.Name = this.DefaultName; if (this.CanContainAttributes) { this.attributes = new ControlAttributeCollection(); } if (this.CanContainControls) { this.controls = new ControlCollection(); } }
private void SetControlPermission(ControlCollection controlCollection) { //new TextBox().Attributes[] foreach (Control chilControl in controlCollection) { if ((chilControl as WebControl) != null) (chilControl as WebControl).Attributes["permissionRequired"] = "Service"; if (chilControl.HasControls()) SetControlPermission(chilControl.Controls); } }
public void AttachVisibilityBindings(ControlCollection controls) { for (int i = 0; (i < controls.Count); i = (i + 1)) { if ((controls[i].DataBindings["Visible"] != null)) { // Attach event handlers to auto-hide controls. controls[i].DataBindings["Visible"].Format += new System.Windows.Forms.ConvertEventHandler(this.Visibility_Format); controls[i].DataBindings["Visible"].DataSourceUpdateMode = System.Windows.Forms.DataSourceUpdateMode.Never; } } }
public static void ClearTextboxes(ControlCollection cc) { foreach (Control ctrl in cc) { TextBox tb = ctrl as TextBox; if (tb != null) { tb.Text = ""; } else ClearTextboxes(ctrl.Controls); } }
//if clear the values in form controls private void ClearControlsData(ControlCollection ctrl) { foreach (Control ctr in ctrl) { if (ctr is TextBox) (ctr as TextBox).Text = " "; if (ctr is DropDownList) (ctr as DropDownList).SelectedIndex = 0; ClearControlsData(ctr.Controls); } }
private void SetControlsReadOnly(ControlCollection cl, bool b) { foreach (Control c in cl) { if (c is IWebDataControl) { IWebDataControl dc = (IWebDataControl)c; dc.RequiredField = false; dc.ReadOnlyWhenInsert = true; dc.ReadOnlyWhenUpdate = true; dc.AllowUpdate = false; dc.AllowInsert = false; } } }
public void ClearControls(ControlCollection ctrl) { foreach (Control ctl in ctrl) { if (ctl is TextBox) { (ctl as TextBox).Text = ""; } if (ctl is DropDownList) { (ctl as DropDownList).SelectedIndex = 0; } ClearControls(ctl.Controls); } }
private void SetTabEnabled(bool isEnabled, ControlCollection collection) { foreach (Control c in collection) { if (c is UcHyperLink) { UcHyperLink obj = c as UcHyperLink; obj.Enabled = isEnabled; } if (c.HasControls()) { SetTabEnabled(isEnabled, c.Controls); } } }
private void DeselectAllTab(ControlCollection collection) { foreach (Control c in collection) { if (c is UcHyperLink) { UcHyperLink obj = c as UcHyperLink; obj.ShowStyle = EnumHyperLinkShowStyle.TabWhite; } if (c.HasControls()) { DeselectAllTab(c.Controls); } } }
private void SaveAllText(ControlCollection controls, bool saveNested) { foreach (Control control in controls) { if (control is TextBox) { // Add the text to a collection. textToSave.Add(control.ID, ((TextBox)control).Text); } if ((control.Controls != null) && saveNested) { SaveAllText(control.Controls, true); } } }
private void SaveAllText(ControlCollection controls, bool saveNested) { foreach (Control control in controls) { if (control is TextBox) { // Store the text using the unique control ID. ViewState[control.ID] = ((TextBox)control).Text; } if ((control.Controls != null) && saveNested) { SaveAllText(control.Controls, true); } } }
private void RestoreAllText(ControlCollection controls, bool saveNested) { foreach (Control control in controls) { if (control is TextBox) { if (ViewState[control.ID] != null) ((TextBox)control).Text = (string)ViewState[control.ID]; } if ((control.Controls != null) && saveNested) { RestoreAllText(control.Controls, true); } } }
public static void ClearFields(ControlCollection pageControls) { foreach (Control contl in pageControls) { string strCntName = (contl.GetType()).Name; switch (strCntName) { case "TextBox": TextBox tbSource = (TextBox)contl; tbSource.Text =""; break; } ClearFields(contl.Controls); } }
void IterControls(ControlCollection controls, StringBuilder builder) { if (controls != null) { string temp; foreach (Control c in controls) { temp = GetValue(c); if (temp != null) { builder.AppendFormat("<strong class=\"ttl\">{0}:</strong> <span class=\"blue\">{1}</span><br/>", c.ID, temp); } else IterControls(c.Controls, builder); } } }
private void RecurseControls(ControlCollection c, string title) { foreach (Control con in c) { if (con.ID == "header") { HtmlGenericControl header = con as HtmlGenericControl; if (header != null) { header.InnerText = title; return; } } this.RecurseControls(con.Controls, title); } }
private void DisplayControl(ControlCollection controls, int depth) { foreach (Control control in controls) { // Use the depth parameter to indent the control tree. Response.Write(new String('-', depth * 4) + "> "); // Display this control. Response.Write(control.GetType().ToString() + " - <b>" + control.ID + "</b><br/>"); if (control.Controls != null) { DisplayControl(control.Controls, depth + 1); } } }
protected void SaveData(ControlCollection controls) { myDictionary = new Dictionary<string, string>(); foreach (Control item in controls) { if(item is TextBox) { myDictionary[item.ID] = ((TextBox)item).Text; } else if(item.HasControls()) { SaveData(item.Controls); } } ViewState["formData"] = myDictionary; }
public static void GenerateRepeatControl(ControlCollection controls, string SystemInfo) { if (!string.IsNullOrEmpty(SystemInfo)) { SystemInfo = SystemInfo.Replace("PP", "P"); string[] RepeatFormStr = SystemInfo.Split('P'); if (RepeatFormStr.Length > 0) { controls.Clear(); foreach (String formStr in RepeatFormStr) { if (!string.IsNullOrEmpty(formStr)) { if (controls.Count != 0) { controls.Add(new LiteralControl(" , ")); } controls.Add(CommonUtility.GetPostbackURLForRepeatForm(formStr)); } } } } }
public Screen(int width, int height, string name) { this.width = width; this.height = height; Name = name; Console.WindowHeight = height; Console.WindowWidth = width; Console.BufferHeight = Console.WindowHeight; Console.BufferWidth = Console.WindowWidth; buffer = new Buffer(0, 0, height, width); Clear(); controls = new ControlCollection<Control>(this); }
public abstract void SetupControl(ControlCollection controls);
private void LoopTextboxes(ControlCollection controlCollection) { int langId = Convert.ToInt32(Session["LanguageId"]); DataSet ds = _BOUtility.GetLanguageDescription(langId); foreach (Control control in controlCollection) { if (control is TextBox) { string text = ((TextBox)control).ID; string place = (((TextBox)control).FindControl(text) as TextBox).Text; if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dtlRow in ds.Tables[0].Rows) { if (dtlRow["Label"].ToString() == text) { string PreviousLabel = dtlRow["Label"].ToString(); string LatestlabelDescrip = dtlRow["LabelDescription"].ToString(); ((TextBox)control).Text = PreviousLabel.Replace(PreviousLabel, LatestlabelDescrip); } } } } if (control is DropDownList) { string text = ((DropDownList)control).ID; string place = (((DropDownList)control).FindControl(text) as DropDownList).Text; if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dtlRow in ds.Tables[0].Rows) { if (dtlRow["Label"].ToString() == text) { string PreviousLabel = dtlRow["Label"].ToString(); string LatestlabelDescrip = dtlRow["LabelDescription"].ToString(); ((DropDownList)control).Text = PreviousLabel.Replace(PreviousLabel, LatestlabelDescrip); } } } } if (control is Button) { string id = ((Button)control).ID; string text = ((Button)control).Text; if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dtlRow in ds.Tables[0].Rows) { if (dtlRow["Label"].ToString() == text) { string PreviousLabel = dtlRow["Label"].ToString(); string LatestlabelDescrip = dtlRow["LabelDescription"].ToString(); ((Button)control).Text = LatestlabelDescrip; } } } } if (control is Label) { string id = ((Label)control).ID; string text = ((Label)control).Text; if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dtlRow in ds.Tables[0].Rows) { if (dtlRow["Label"].ToString() == text) { string PreviousLabel = dtlRow["Label"].ToString(); string LatestlabelDescrip = dtlRow["LabelDescription"].ToString(); ((Label)control).Text = LatestlabelDescrip; } } } } System.Web.UI.HtmlControls.HtmlHead chk = control as System.Web.UI.HtmlControls.HtmlHead; if (chk != null) { //string text = chk.InnerHtml } //Label mylabel; //if (control.GetType() == typeof(Label)) //or any other logic //{ // mylabel = (Label)control; // mylabel.BackColor = Color.Red; //} if (control.Controls != null) { LoopTextboxes(control.Controls); } } }
public static T Create <T>(this ControlCollection ctls, string id) where T : Control, new() { return(Create <T>(ctls).ID(id)); }
/// <summary> /// Adds the control. /// </summary> /// <param name="controls">The controls.</param> /// <param name="options">The options.</param> /// <returns></returns> public Control AddControl(ControlCollection controls, AttributeControlOptions options) { options.LabelText = options.LabelText ?? Name; options.HelpText = options.HelpText ?? Description; options.AttributeControlId = options.AttributeControlId ?? $"attribute_field_{Id}"; EntityTypeCache entityType = EntityTypeId.HasValue ? EntityTypeCache.Get(this.EntityTypeId.Value) : null; bool showPrePostHtml = (entityType?.AttributesSupportPrePostHtml ?? false) && (options?.ShowPrePostHtml ?? true); var attributeControl = FieldType.Field.EditControl(QualifierValues, options.SetId ? options.AttributeControlId : string.Empty); if (attributeControl == null) { return(null); } var hasAttributeIdControl = attributeControl as IHasAttributeId; if (hasAttributeIdControl != null) { hasAttributeIdControl.AttributeId = this.Id; } if (options.SetId) { attributeControl.ClientIDMode = ClientIDMode.AutoID; } // If the control is a RockControl var rockControl = attributeControl as IRockControl; var controlHasRequired = attributeControl as IHasRequired; if (showPrePostHtml) { if (this.PreHtml.IsNotNullOrWhiteSpace()) { controls.Add(new Literal { Text = this.PreHtml }); } } if (rockControl != null) { var isRequired = options.Required ?? IsRequired; rockControl.Label = options.LabelText; rockControl.Help = options.HelpText; rockControl.Warning = options.WarningText; rockControl.Required = isRequired; rockControl.ValidationGroup = options.ValidationGroup; if (options.LabelText.IsNullOrWhiteSpace() && isRequired) { rockControl.RequiredErrorMessage = $"{Name} is required."; } controls.Add(attributeControl); } else { if (controlHasRequired != null) { controlHasRequired.Required = options.Required ?? IsRequired; controlHasRequired.ValidationGroup = options.ValidationGroup; } bool renderLabel = !string.IsNullOrEmpty(options.LabelText); bool renderHelp = !string.IsNullOrWhiteSpace(options.HelpText); bool renderWarning = !string.IsNullOrWhiteSpace(options.WarningText); if (renderLabel || renderHelp || renderWarning) { var div = new DynamicControlsHtmlGenericControl("div") { ID = $"_formgroup_div_{Id}" }; controls.Add(div); div.Controls.Clear(); div.AddCssClass("form-group"); if (IsRequired) { div.AddCssClass("required"); } div.ClientIDMode = ClientIDMode.AutoID; if (renderLabel) { var label = new Label { ID = $"_label_{Id}", ClientIDMode = ClientIDMode.AutoID, Text = options.LabelText, CssClass = "control-label", AssociatedControlID = attributeControl.ID }; div.Controls.Add(label); } if (renderHelp) { var helpBlock = new HelpBlock { ID = $"_helpBlock_{Id}", ClientIDMode = ClientIDMode.AutoID, Text = options.HelpText }; div.Controls.Add(helpBlock); } if (renderWarning) { var warningBlock = new WarningBlock { ID = $"_warningBlock_{Id}", ClientIDMode = ClientIDMode.AutoID, Text = options.WarningText }; div.Controls.Add(warningBlock); } div.Controls.Add(attributeControl); } else { controls.Add(attributeControl); } } if (options.ShowPrePostHtml) { if (this.PostHtml.IsNotNullOrWhiteSpace()) { controls.Add(new Literal { Text = this.PostHtml }); } } if (options.SetValue) { FieldType.Field.SetEditValue(attributeControl, QualifierValues, options.Value); } return(attributeControl); }
public ColorMenager_old() { this.controls = new ControlCollection(); this.controls.ControlAdded += new EventHandler(controls_ControlAdded); }
private void SetChildControlCollection(ControlCollection controls) { SetChildControlCollectionInternal(_targetControl, controls); }
public Setting Login(object setting) { Setting _setting = (setting) as Setting; if (_setting != null) { string RawUrl = _setting.RawUrl; string UrlHost = _setting.UrlHost; string Username = _setting.UserName; string Pass = _setting.Pass; //if (HttpContext.Current.Request.UrlReferrer != null) // if ( // HttpContext.Current.Request.UserHostAddress != "127.0.0.1" && // !HttpContext.Current.Request.UrlReferrer.PathAndQuery.ToLower().Contains("iranamlaak.ir")) // { // SetCaptcha(ref _setting); // return _setting; // } if (!ValidateInputs(Username, Pass, ref _setting)) { SetCaptcha(_setting); return(_setting); } SetCaptcha(_setting); _setting.CaptchaVisible = true; BOLLogs logsBOL = new BOLLogs(); _setting.CircleVisible = false; _setting.MsgVisible = false; if (string.IsNullOrEmpty(Username)) { _setting.MsgVisible = true; _setting.MsgText = "کلمه عبور را وارد نمایید"; SetCaptcha(_setting); return(_setting); } if (string.IsNullOrEmpty(Pass)) { _setting.MsgVisible = true; _setting.MsgText = "رمز عبور را وارد نمایید"; SetCaptcha(_setting); return(_setting); } string strlogContent = "<login><UserName>" + Username + "</UserName><Password>" + Pass + "</Password></login>"; try { Users ValidUser = BOLUsers.GetDataByUsername(Username); if (ValidUser != null) { Session["UserName"] = Username; string HashedPass; string DBPassword = ValidUser.Password; if (ValidUser.Username != Username) { _setting.MsgText = Messages.ShowMessage(MessagesEnum.InvalidUsernameORPassword); SetCaptcha(_setting); return(_setting); } //تعداد دفعات ورود به سیستم //if (!BOLUsers.CheckForLoginTryCount(ValidUser.Code, ValidUser.HCUserBlockedCode, strlogContent, // Server.MapPath("~/Configuration.xml"), RawUrl, UrlHost)) //{ // _setting.MsgText = Messages.ShowMessage(MessagesEnum.InvalidLoginCount); // _setting.MsgVisible = true; // logsBOL.InsertIntoLogs((int)Enums.LogTypes.enm_InvalidLoginCount, ValidUser.Code, strlogContent, RawUrl, UrlHost); // SetCaptcha(_setting); // return _setting; //} if ((bool)ValidUser.IsPasswordSHA1) { HashedPass = Tools.EncryptSHA1(Pass); } else { HashedPass = Tools.EncryptRIC(Pass).ToString(); if (HashedPass == DBPassword) { BOLUsers.ConvertRICtoSHA1(ValidUser.Code, Pass); } } if (HashedPass == DBPassword)//اگر کلمه عبور وارد شده صحیح بود { GetGroupCode(ValidUser.Code); //Login Successful var UsersBOL = new BOLUsers(); Users CurUser = UsersBOL.GetDataByUsername(Username); _setting.CircleVisible = true; // _setting.MsgText = "در حال ورود به سیستم"; GetGroupName(ValidUser.Code); FillSessions(ValidUser.Code, Username); //... DateTimeMethods dtM = new DateTimeMethods(); string strCurrent_Date = dtM.GetPersianDateTime(DateTime.Now); //...Fill User Info in Application["ActiveUsersLst"] //... bool blnCnt; string strNewToCache = HttpContext.Current.Session.SessionID + "," + ValidUser.Code + "," + Session["FirstName"] + " " + Session["LastName"] + "," + Session["GroupName"] + "," + Session["ZoneName"] + "," + strCurrent_Date + "," + HttpContext.Current.Request.UserHostAddress + ""; string strNewApp = SetToCache(ValidUser.Code, strNewToCache, out blnCnt); Application.Lock(); Application["ActiveUsersLst"] = strNewApp; if (blnCnt) { Application["ActiveUsersCnt"] = Convert.ToInt32(Application["ActiveUsersCnt"]) + 1; } Application.UnLock(); //... //logsBOL.InsertIntoLogs((int)Enums.LogTypes.enm_Login, ValidUser.Code, "<login><UserName>" + Username + "</UserName></login>", RawUrl, UrlHost); } else { _setting.MsgText = Messages.ShowMessage(MessagesEnum.InvalidLogin); _setting.MsgVisible = true; //logsBOL.InsertIntoLogs((int)Enums.LogTypes.enm_InvalidLogin, ValidUser.Code, strlogContent, RawUrl, UrlHost); } } else { _setting.MsgText = Messages.ShowMessage(MessagesEnum.InvalidLogin); _setting.MsgVisible = true; //logsBOL.InsertIntoLogs((int)Enums.LogTypes.enm_InvalidLogin, 0, strlogContent, RawUrl, UrlHost); } } catch (Exception ex) { ControlCollection cc = GetPageControls(Username, Pass); Tools.LogException(ex, cc); _setting.MsgText = "خطا در شبکه"; _setting.MsgVisible = true; //if (Session["userCode"] != null) // logsBOL.InsertIntoLogs((int)Enums.LogTypes.enm_ErrorInNetwork, Convert.ToInt32(Session["userCode"]), strlogContent, RawUrl, UrlHost); //else // logsBOL.InsertIntoLogs((int)Enums.LogTypes.enm_ErrorInNetwork, 0, strlogContent, RawUrl, UrlHost); } } SetCaptcha(_setting); return(_setting); }
protected void Page_Load(object sender, System.EventArgs e) { if (DisablePasswordAutocomplete) { TextBox tbPassword = ctrlLogin.FindControl("Password") as TextBox; AppLogic.DisableAutocomplete(tbPassword); AppLogic.DisableAutocomplete(tbOldPassword); AppLogic.DisableAutocomplete(tbNewPassword); AppLogic.DisableAutocomplete(tbNewPassword2); } String EMailField = ctrlLogin.UserName.ToLowerInvariant().Trim(); if (String.IsNullOrEmpty(EMailField)) { EMailField = ctrlRecoverPassword.UserName; } if (!string.IsNullOrEmpty(EMailField)) { ThisCustomer = new Customer(EMailField); } if (ThisCustomer == null) { ThisCustomer = (Page as AspDotNetStorefront.SkinBase).ThisCustomer; } m_SkinID = (Page as AspDotNetStorefront.SkinBase).SkinID; ControlCollection ctrlcol = ctrlLogin.Controls; PopulateFields(ctrlcol); lblReturnURL.Text = CommonLogic.QueryStringCanBeDangerousContent("ReturnURL"); if (CommonLogic.QueryStringNativeInt("ErrorMsg") > 0) { ErrorMessage err = new ErrorMessage(CommonLogic.QueryStringNativeInt("ErrorMsg")); ErrorMsgLabel.Text = err.Message; } else { ErrorMsgLabel.Text = string.Empty; } ErrorPanel.Visible = true; AppLogic.CheckForScriptTag(lblReturnURL.Text); if (AppLogic.IsAdminSite || CommonLogic.GetThisPageName(true).ToLowerInvariant().IndexOf(AppLogic.AdminDir().ToLowerInvariant() + "/") != -1 || lblReturnURL.Text.ToLowerInvariant().IndexOf(AppLogic.AdminDir().ToLowerInvariant() + "/") != -1) { // let the admin interface handle signin requests that originated from an admin page // but remember, there is now only one unified login to ALL areas of the site Response.Redirect("~/" + AppLogic.AdminDir() + "/signin.aspx"); } lblPwdChgErr.Text = ""; if (!Page.IsPostBack) { cbDoingCheckout.Checked = CommonLogic.QueryStringBool("checkout"); if (lblReturnURL.Text.Length == 0) { if (CommonLogic.QueryStringBool("checkout")) { lblReturnURL.Text = "~/shoppingcart.aspx?checkout=true"; } else { lblReturnURL.Text = "~/default.aspx"; } } hlSignUpLink.NavigateUrl = "~/createaccount.aspx?checkout=" + cbDoingCheckout.Checked.ToString(); CheckoutPanel.Visible = cbDoingCheckout.Checked; CheckoutMap.HotSpots[0].AlternateText = AppLogic.GetString("checkoutanon.aspx.2", m_SkinID, ThisCustomer.LocaleSetting); } //if captcha security is enabled if (AppLogic.AppConfigBool("SecurityCodeRequiredOnStoreLogin")) { tbSecurityCode.Visible = true; imgSecurityImage.Visible = true; imgSecurityImage.ImageUrl = "~/Captcha.ashx?id=1"; lblSecurityLabel.Visible = true; rfvSecurity.Enabled = true; } }
/// <summary> /// 得到搜索条件 /// </summary> /// <param name="page"></param> /// <param name="type"></param> /// <param name="query"></param> /// <param name="ctrls"></param> public static void SetFindQueryByControls(this Page page, Type type, QueryInfo query, ControlCollection ctrls) { var where = new StringBuilder(); var having = new StringBuilder(); AddQueryByControls(type, query, where, having, ctrls); SetFindWhere(query, where); SetFindHaving(query, having); }
public static void AddDiv4OkMessage(this ControlCollection controls, TestRule rule, TestSent sent) { controls.AddDiv(rule.ToString() + '.' + sent.ToString() + " - OK"); }
public static void AddDiv4ExceptionMessage(this ControlCollection controls, Exception ex, TestRule rule, TestSent sent) { controls.Add(CreateDiv4ExceptionMessage(ex, rule, sent)); }
public static void AddDiv4FinalMessage(this ControlCollection controls, TestXmlFile testXmlFile, int errorCount, Stopwatch sw) { controls.AddDiv("<br/> (Всего: " + testXmlFile.TestRules.Sum(_ => _.TestSents.Count) + " штук, " + ((errorCount == 0) ? "Ошибок НЕТ" : "Ошибок: " + errorCount + " штук") + ", Время: " + sw.Elapsed); }
public static void AddDiv(this ControlCollection controls, string text) { controls.Add(CreateDiv(text)); }
private static void BaseEventHandler(string consoleId, string elementProviderName, FlowToken flowToken, FormFlowUiDefinition formFlowUiCommand, FlowControllerServicesContainer servicesContainer, Dictionary <IFormEventIdentifier, FormFlowEventHandler> eventHandlers, IFormEventIdentifier localScopeEventIdentifier, FlowControllerServicesContainer formServicesContainer) { FormTreeCompiler activeFormTreeCompiler = CurrentFormTreeCompiler; Dictionary <string, object> activeInnerFormBindings = CurrentInnerFormBindings; FormFlowEventHandler handler = eventHandlers[localScopeEventIdentifier]; Dictionary <string, Exception> bindingErrors = activeFormTreeCompiler.SaveAndValidateControlProperties(); formServicesContainer.AddService(new BindingValidationService(bindingErrors)); handler.Invoke(flowToken, activeInnerFormBindings, formServicesContainer); if (formServicesContainer.GetService <IManagementConsoleMessageService>().CloseCurrentViewRequested) { ViewTransitionHelper.HandleCloseCurrentView(formFlowUiCommand.UiContainerType); return; } var formFlowService = (FormFlowRenderingService)formServicesContainer.GetService <IFormFlowRenderingService>(); bool replacePageOutput = (formServicesContainer.GetService <IFormFlowWebRenderingService>().NewPageOutput != null); bool rerenderView = formFlowService.RerenderViewRequested; if (formFlowService.BindingPathedMessages != null) { ShowFieldMessages(CurrentControlTreeRoot, formFlowService.BindingPathedMessages, CurrentControlContainer, servicesContainer); } List <bool> boolCounterList = new List <bool> { replacePageOutput, rerenderView }; if (boolCounterList.Count(f => f) > 1) { StringBuilder sb = new StringBuilder("Flow returned conflicting directives for post handling:\n"); if (replacePageOutput) { sb.AppendLine(" - Replace page output with new web control."); } if (rerenderView) { sb.AppendLine(" - Rerender view."); } throw new InvalidOperationException(sb.ToString()); } if (rerenderView) { Log.LogVerbose("FormFlowRendering", "Re-render requested"); IFlowUiDefinition newFlowUiDefinition = FlowControllerFacade.GetCurrentUiDefinition(flowToken, servicesContainer); if (!(newFlowUiDefinition is FlowUiDefinitionBase)) { throw new NotImplementedException("Unable to handle transitions to ui definition of type " + newFlowUiDefinition.GetType()); } ViewTransitionHelper.HandleRerender(consoleId, elementProviderName, flowToken, formFlowUiCommand, (FlowUiDefinitionBase)newFlowUiDefinition, servicesContainer); } if (replacePageOutput) { Log.LogVerbose("FormFlowRendering", "Replace pageoutput requested"); IFormFlowWebRenderingService webRenderingService = formServicesContainer.GetService <IFormFlowWebRenderingService>(); Control newPageOutput = webRenderingService.NewPageOutput; foreach (Control control in GetNestedControls(newPageOutput).Where(f => f is ScriptManager).ToList()) { control.Parent.Controls.Remove(control); } Page currentPage = HttpContext.Current.Handler as Page; HtmlHead newHeadControl = GetNestedControls(newPageOutput).FirstOrDefault(f => f is HtmlHead) as HtmlHead; HtmlHead oldHeadControl = currentPage.Header; ControlCollection headContainer = null; bool headersHasToBeSwitched = newHeadControl != null && oldHeadControl != null; if (headersHasToBeSwitched) { headContainer = newHeadControl.Parent.Controls; headContainer.Remove(newHeadControl); } currentPage.Controls.Clear(); if (string.IsNullOrEmpty(webRenderingService.NewPageMimeType)) { currentPage.Response.ContentType = "text/html"; } else { currentPage.Response.ContentType = webRenderingService.NewPageMimeType; } currentPage.Controls.Add(newPageOutput); if (headersHasToBeSwitched) { oldHeadControl.Controls.Clear(); oldHeadControl.InnerHtml = ""; oldHeadControl.InnerText = ""; if (newHeadControl.ID != null) { oldHeadControl.ID = newHeadControl.ID; } oldHeadControl.Title = newHeadControl.Title; headContainer.AddAt(0, oldHeadControl); foreach (Control c in newHeadControl.Controls.Cast <Control>().ToList()) { oldHeadControl.Controls.Add(c); } } } }
/// <summary> /// Adds the control. /// </summary> /// <param name="controls">The controls.</param> /// <param name="value">The value.</param> /// <param name="validationGroup">The validation group.</param> /// <param name="setValue">if set to <c>true</c> [set value].</param> /// <param name="setId">if set to <c>true</c> [set id].</param> /// <param name="required">The required.</param> /// <param name="labelText">The label text.</param> /// <param name="helpText">The help text.</param> /// <returns></returns> public Control AddControl(ControlCollection controls, string value, string validationGroup, bool setValue, bool setId, bool?required = null, string labelText = null, string helpText = null) { if (labelText == null) { labelText = this.Name; } if (helpText == null) { helpText = this.Description; } Control attributeControl = this.FieldType.Field.EditControl(QualifierValues, setId ? string.Format("attribute_field_{0}", this.Id) : string.Empty); if (attributeControl != null) { if (setId) { attributeControl.ClientIDMode = ClientIDMode.AutoID; } // If the control is a RockControl var rockControl = attributeControl as IRockControl; if (rockControl != null) { controls.Add(attributeControl); rockControl.Label = labelText; rockControl.Help = helpText; rockControl.Required = required.HasValue ? required.Value : this.IsRequired; rockControl.ValidationGroup = validationGroup; } else { bool renderLabel = !string.IsNullOrEmpty(labelText); bool renderHelp = !string.IsNullOrWhiteSpace(helpText); if (renderLabel || renderHelp) { HtmlGenericControl div = new HtmlGenericControl("div"); controls.Add(div); div.Controls.Clear(); div.AddCssClass("form-group"); if (this.IsRequired) { div.AddCssClass("required"); } div.ClientIDMode = ClientIDMode.AutoID; if (renderLabel) { Label label = new Label(); div.Controls.Add(label); label.ClientIDMode = ClientIDMode.AutoID; label.Text = labelText; label.CssClass = "control-label"; label.AssociatedControlID = attributeControl.ID; } if (renderHelp) { var helpBlock = new Rock.Web.UI.Controls.HelpBlock(); div.Controls.Add(helpBlock); helpBlock.ClientIDMode = ClientIDMode.AutoID; helpBlock.Text = helpText; } div.Controls.Add(attributeControl); } else { controls.Add(attributeControl); } } if (setValue) { this.FieldType.Field.SetEditValue(attributeControl, QualifierValues, value); } } return(attributeControl); }
/// <summary> /// 得到搜索条件 /// </summary> /// <param name="page"></param> /// <param name="query"></param> /// <param name="ctrls"></param> public static void SetFindQueryByControls <T>(this Page page, QueryInfo query, ControlCollection ctrls) { SetFindQueryByControls(page, typeof(T), query, ctrls); }
internal HtmlTableRowCollection(HtmlTable table) { cc = table.Controls; }
/// <summary> /// Replaces a specific index in a control collection /// </summary> /// <param name="originalCollection">The collection that is being modified</param> /// <param name="indexToReplace">The index to be replaced</param> /// <param name="newControl">The new control to replace the old control</param> public static void Replace(this ControlCollection originalCollection, int indexToReplace, Control newControl) { originalCollection.Insert(indexToReplace, newControl); originalCollection.RemoveAt(indexToReplace + 1); }
/// <summary> /// 添加查询 /// </summary> /// <param name="type"></param> /// <param name="query"></param> /// <param name="where"></param> /// <param name="having"></param> /// <param name="ctrls"></param> private static void AddQueryByControls(Type type, QueryInfo query, StringBuilder where, StringBuilder having, ControlCollection ctrls) { foreach (Control ctrl in ctrls) { AddQueryByControl(type, query, where, having, ctrl); if (ctrl.Controls.Count > 0) { AddQueryByControls(type, query, where, having, ctrl.Controls); } } }
/// <summary>Инициализация пользовательских контролов</summary> private void f_AddControlsTemplate(Cl_Template a_Template, ControlCollection a_Controls = null) { if (m_Record != null && a_Template != null) { if (a_Template.p_TemplateElements == null) { var cTe = Cl_App.m_DataContext.Entry(a_Template).Collection(g => g.p_TemplateElements).Query().Include(te => te.p_ChildElement).Include(te => te.p_ChildElement.p_Default).Include(te => te.p_ChildElement.p_ParamsValues).Include(te => te.p_ChildElement.p_PartAgeNorms).Include(te => te.p_ChildTemplate); cTe.Load(); } if (a_Template.p_TemplateElements != null && a_Template.p_TemplateElements.Count > 0) { int top = 0; ControlCollection controls = null; if (a_Controls != null) { controls = a_Controls; } else { controls = ctrlContent.Controls; } foreach (var te in a_Template.p_TemplateElements) { if (te.p_ChildElement != null) { var ctrlEl = new Ctrl_Element(); ctrlEl.p_Element = te.p_ChildElement; ctrlEl.e_ValueChanged += CtrlEl_e_ValueChanged; Cl_RecordValue recval = m_Record.p_Values.FirstOrDefault(v => v.p_ElementID == te.p_ChildElement.p_ID); if (recval == null) { recval = new Cl_RecordValue(); recval.p_ElementID = ctrlEl.p_Element.p_ID; recval.p_Element = ctrlEl.p_Element; recval.p_RecordID = m_Record.p_ID; recval.p_Record = m_Record; } if (controls is TableLayoutControlCollection && controls.Owner is TableLayoutPanel) { var table = (TableLayoutPanel)controls.Owner; table.RowCount++; table.RowStyles.Add(new RowStyle(SizeType.AutoSize)); ctrlEl.f_SetRecordElementValues(recval, table, table.RowCount - 1); } else { ctrlEl.f_SetRecordElementValues(recval); controls.Add(ctrlEl); } ctrlEl.Top = top; ctrlEl.Left = m_PaddingX; top += ctrlEl.Height + m_PaddingY; m_Elements.Add(ctrlEl); } else if (te.p_ChildTemplate != null) { if (te.p_ChildTemplate.p_Type == Cl_Template.E_TemplateType.Block) { var ctrlGroup = new GroupBox(); ctrlGroup.Text = te.p_ChildTemplate.p_Name; ctrlGroup.AutoSize = true; ctrlGroup.Top = top; FlowLayoutPanel panel = new FlowLayoutPanel(); panel.Top = 20; panel.Left = 3; panel.WrapContents = false; panel.AutoSize = true; panel.FlowDirection = FlowDirection.TopDown; ctrlGroup.Controls.Add(panel); controls.Add(ctrlGroup); f_AddControlsTemplate(te.p_ChildTemplate, panel.Controls); top += ctrlGroup.Height + m_PaddingY; } else if (te.p_ChildTemplate.p_Type == Cl_Template.E_TemplateType.Table) { var ctrlTable = f_GetControlTable(); ctrlTable.AutoSize = true; top += 10; ctrlTable.Top = top; ctrlTable.CellBorderStyle = TableLayoutPanelCellBorderStyle.InsetDouble; ctrlTable.RowCount = 1; ctrlTable.Controls.Add(new Label() { Text = "Показатель", TextAlign = System.Drawing.ContentAlignment.MiddleLeft }, 0, 0); //ctrlTable.Controls.Add(new Label() { Text = "Локация", TextAlign = System.Drawing.ContentAlignment.MiddleLeft }, 1, 0); ctrlTable.Controls.Add(new Label() { Text = "Значение", TextAlign = System.Drawing.ContentAlignment.MiddleLeft }, 1, 0); ctrlTable.Controls.Add(new Label() { Text = "Ед. изм.", TextAlign = System.Drawing.ContentAlignment.MiddleLeft }, 2, 0); ctrlTable.Controls.Add(new Label() { Text = "Нормa", TextAlign = System.Drawing.ContentAlignment.MiddleLeft }, 3, 0); controls.Add(ctrlTable); f_AddControlsTemplate(te.p_ChildTemplate, ctrlTable.Controls); top += ctrlTable.Height + m_PaddingY; } } } } } }
public ChildWindow() { mvarControls = new ControlCollection(this); }
private void OnSplitTypeChange(SplitTypes splitType) { bool previouslyFinished = IsFinished; Control[] controls = splitType != SplitTypes.Manual ? functionMap[splitType]() : null; ControlCollection panelControls = splitDetailsPanel.Controls; panelControls.Clear(); if (controls != null) { for (int i = 0; i < controls.Length; i++) { var control = controls[i]; if (i > 0) { control.Location = new Point(controls[i - 1].Bounds.Right + ControlSpacing, 0); } panelControls.Add(control); } } // Item splits require two lines. if (splitType == SplitTypes.Item) { Height = Height * 2 - ItemSplitCorrection; splitDetailsPanel.Height = splitDetailsPanel.Height * 2 + ControlSpacing; Control[] secondaryControls = GetItemSecondaryControls(); int y = controls[0].Bounds.Bottom + ControlSpacing; for (int i = 0; i < secondaryControls.Length; i++) { Control control = secondaryControls[i]; Point point = new Point(0, y); if (i > 0) { point.X = secondaryControls[i - 1].Bounds.Right + ControlSpacing; } control.Location = point; panelControls.Add(control); LinkItemLines(controls, secondaryControls); } // Changing an existing split to an item split can cause later splits to be shifted down. if (Index < parent.SplitCount - 1) { parent.ShiftSplits(Index + 1); } } else if (previousSplitType == SplitTypes.Item) { Height = (Height + ItemSplitCorrection) / 2; splitDetailsPanel.Height = (splitDetailsPanel.Height - ControlSpacing) / 2; parent.ShiftSplits(Index + 1); } if (previouslyFinished) { // Changing the split type always adds new, empty controls, which means the new split is unfinished by // default (unless it's manual). if (splitType != SplitTypes.Manual) { parent.UnfinishedCount++; IsFinished = false; } } else if (splitType == SplitTypes.Manual || splitType == SplitTypes.Quitout) { parent.UnfinishedCount--; IsFinished = true; } previousSplitType = splitType; }
public abstract void Render(ControlCollection collection);
public static T CreateSitecoreControl <T>(string name, string value, Unit width, ControlCollection controls, string idFromName, bool trackModified, bool disabled) where T : Input, new() { var control = CreateSitecoreControl <T>(name, value, controls, idFromName, trackModified, disabled); control.Width = width; return(control); }
/// <summary> /// Copies the elements of the <c>ControlCollection</c> to a new array /// </summary> /// <param name="controlCollection">The control collection to copy from</param> /// <returns>A list containing all controls</returns> public static Control[] ToArray(this ControlCollection controlCollection) { return(controlCollection.ToList().ToArray()); }
public static void CreateLitertal(string text, ControlCollection controls) { controls.Add(new LiteralControl(text)); }
/// <summary> /// Adds the control. /// </summary> /// <param name="controls">The controls.</param> /// <param name="value">The value.</param> /// <param name="validationGroup">The validation group.</param> /// <param name="setValue">if set to <c>true</c> [set value].</param> /// <param name="setId">if set to <c>true</c> [set id].</param> /// <param name="required">The required.</param> /// <param name="labelText">The label text.</param> /// <param name="helpText">The help text.</param> /// <param name="warningText">The warning text.</param> /// <returns></returns> public Control AddControl(ControlCollection controls, string value, string validationGroup, bool setValue, bool setId, bool?required = null, string labelText = null, string helpText = null, string warningText = null) { return(AddControl(controls, value, validationGroup, setValue, setId, required, labelText, helpText, warningText, null)); }
public override void setTabIndex(int TabIndex, out ControlCollection ctlcollection, out string UcPath) { FBABIPGeneralTabPage.ActiveTabIndex = (short)TabIndex; ctlcollection = FBABIPGeneralTabPage.TabPages[TabIndex].Controls; UcPath = FBABIPGeneralTabPage.TabPages[TabIndex].Name; }
protected override void InitializeControls(GenericContainer container) { _currentSiteId = SystemManager.CurrentContext.CurrentSite.Id; _sfTrackingCookie = HttpContext.Current.Request.Cookies["sf-trckngckie"]; switch (ExtendedFormType) { case "conditional": _isConditionalForm = true; break; case "progressive": _isProgressiveForm = true; break; } if (_isProgressiveForm) { _isProgressiveForm = true; _priorFormEntry = GetPriorFormEntry(); } if (!this.IsLicensed) { this.ErrorsPanel.Visible = true; ControlCollection controls = this.ErrorsPanel.Controls; Label label = new Label() { Text = Res.Get <FormsResources>().ModuleNotLicensed }; controls.Add(label); return; } if (this.FormData != null) { bool flag = true; CultureInfo currentUICulture = CultureInfo.CurrentUICulture; if (this.CurrentLanguage != null) { currentUICulture = new CultureInfo(this.CurrentLanguage); } if (!this.FormData.IsPublished(currentUICulture)) { flag = false; } if (flag) { this.RenderFormFields(); } } if (!this.formDescriptionFound && this.IsDesignMode()) { this.ErrorsPanel.Visible = true; ControlCollection controlCollections = this.ErrorsPanel.Controls; Label label1 = new Label() { Text = Res.Get <FormsResources>().TheSpecifiedFormNoLongerExists }; controlCollections.Add(label1); } HttpContextBase currentHttpContext = SystemManager.CurrentHttpContext; if (currentHttpContext != null && this.formDescriptionFound) { if (!currentHttpContext.Items.Contains("PageFormControls")) { currentHttpContext.Items["PageFormControls"] = string.Empty; } currentHttpContext.Items["PageFormControls"] = string.Format("{0}Id={1},ValidationGroup={2};", (string)currentHttpContext.Items["PageFormControls"], this.FormId, this.ValidationGroup); } }
public static void AddHr(this ControlCollection controls) { controls.Add(CreateHr()); }