/// <summary> /// クライアントでのバリデーション用の操作 /// </summary> /// <param name="context">クライアントのバリデーションコンテキスト</param> public void AddValidation(ClientModelValidationContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (MinLength > 0) { // 最小値が設定されている場合以下のタグ属性を設定する // minlength 最小桁数 // min-length-err-msg バリデーションで設定されたエラーメッセージ context.Attributes["minlength"] = MinLength.ToString(); if (!string.IsNullOrWhiteSpace(UnderMinErrorMessage)) { context.Attributes["minlength-err-msg"] = UnderMinErrorMessage; } } if (MaxLength > 0) { // 最大値が設定されている場合以下のタグ属性を設定する // maxlength 最大桁数 // max-length-err-msg バリデーションで設定されたエラーメッセージ context.Attributes["maxlength"] = MaxLength.ToString(); if (!string.IsNullOrWhiteSpace(OverMaxErrorMessage)) { context.Attributes["maxlength-err-msg"] = OverMaxErrorMessage; } } }
protected override void OnPreRender(EventArgs e) { if (MaxLength > 0) { Attributes["maxlength"] = MaxLength.ToString(); } if (Size > 0) { Attributes["size"] = Size.ToString(); } if (!string.IsNullOrEmpty(WaterMarkText)) { CssClass += " watermark"; Attributes["watermarkvalue"] = WaterMarkText; } if (!string.IsNullOrEmpty(EnterKeyActivates)) { Attributes["enteractivates"] = EnterKeyActivates; } base.OnPreRender(e); }
/// <summary> /// 入力ダイアログ /// </summary> /// <returns></returns> protected override bool DoInput() { bool ret = false; string msgfmt = CommonProc.MessageText("G003"); msgfmt = msgfmt.Replace("%param", ParamName); msgfmt = msgfmt.Replace("%length", MaxLength.ToString()); if (AllowJapanese) { IMEInputTextDialog tdlg = new IMEInputTextDialog(); tdlg.InputText = frontend.Text; tdlg.Caption = msgfmt; tdlg.MaxLength = MaxLength; if (tdlg.ShowDialog() == DialogResult.OK) { frontend.Text = tdlg.InputText; ret = true; } tdlg.Dispose(); } else { KeyboardDialog kdlg = new KeyboardDialog(); kdlg.InputArea = frontend.Text; kdlg.Message_Text = msgfmt; kdlg.DispMode = 0; //テキスト if (kdlg.ShowDialog() == DialogResult.OK) { frontend.Text = kdlg.InputArea; ret = true; } kdlg.Dispose(); } return(ret); }
/// <summary> /// クライアントでのバリデーション用の操作 /// </summary> /// <param name="context">クライアントのバリデーションコンテキスト</param> public void AddValidation(ClientModelValidationContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (MinLength > 0) { // 最小値が設定されている場合以下のタグ属性を設定する // minlength 最小桁数 // notsupported-min-length-err-msg 未サポートブラウザでのエラーメッセージ // min-length-err-msg バリデーションで設定されたエラーメッセージ MergeAttribute(context.Attributes, "minlength", MinLength.ToString()); MergeAttribute(context.Attributes, "notsupported-min-length-err-msg", "最小桁数「" + MinLength.ToString() + "」より短いです。"); if (!string.IsNullOrWhiteSpace(UnderMinErrorMessage)) { MergeAttribute(context.Attributes, "min-length-err-msg", UnderMinErrorMessage); } } if (MaxLength > 0) { // 最大値が設定されている場合以下のタグ属性を設定する // maxlength 最大桁数 // notsupported-max-length-err-msg 未サポートブラウザでのエラーメッセージ // max-length-err-msg バリデーションで設定されたエラーメッセージ MergeAttribute(context.Attributes, "maxlength", MaxLength.ToString()); MergeAttribute(context.Attributes, "notsupported-max-length-err-msg", "最大桁数「" + MaxLength.ToString() + "」より長いです。"); if (!string.IsNullOrWhiteSpace(ErrorMessageString)) { MergeAttribute(context.Attributes, "max-length-err-msg", ErrorMessageString); } } }
public void WriteToFile(string filePath) { var bytes = Encoding.UTF8.GetBytes(MaxLength.ToString()); using (var fileStream = new FileStream(filePath, FileMode.OpenOrCreate)) { fileStream.Write(bytes, 0, bytes.Length); } }
/// <summary> /// Renders control. /// </summary> /// <param name="writer">The HtmlTextWriter to render content to.</param> protected override void Render(HtmlTextWriter writer) { if (writer == null) { return; } bool renderSecondRow = ((Required || (RangeValidation && ValidationType != CustomValidationDataType.String) || RegularExpressionValidation) && Enabled && (!ReadOnly)); if (this.Theme != MasterPageTheme.Modern) { BaseValidatedControl.RenderValidatedControlBeginTag(Required && ShowRequired, writer, this.Width); } if (Masked) { if (!this.Width.IsEmpty) { m_RadMaskedTextBox.Width = ((this.Theme == MasterPageTheme.Modern) ? this.Width : Unit.Percentage(100)); } m_RadMaskedTextBox.RenderControl(writer); } else { if (!this.Width.IsEmpty) { m_TextBox.Width = ((this.Theme == MasterPageTheme.Modern) ? this.Width : Unit.Percentage(100)); } if (MultiLineMode && (MaxLength > 0)) { m_TextBox.Attributes.Add("maxLength", MaxLength.ToString(CultureInfo.CurrentCulture)); } m_TextBox.RenderControl(writer); if (LengthInfoEnabled) { string lengthInfoStringFormat = ((MaxLength > 0) ? Resources.TextBox_LengthInfoStringFormat2 : Resources.TextBox_LengthInfoStringFormat1); writer.Write("<br />"); m_Span.RenderControl(writer); writer.Write(string.Format(CultureInfo.CurrentCulture, " " + lengthInfoStringFormat, MaxLength)); } } if (this.Theme != MasterPageTheme.Modern) { BaseValidatedControl.RenderValidatedControlMiddleTag(renderSecondRow, writer); } this.RenderValidators(writer); if (this.Theme != MasterPageTheme.Modern) { BaseValidatedControl.RenderValidatedControlEndTag(renderSecondRow, writer); } }
public string printListingForParkWide(int duration) { string accessible = Accessible == 0 ? "No" : "Yes"; string utilities = Utilities == 0 ? "N/A" : "Yes"; string rvLength = MaxLength == 0 ? "N/A" : MaxLength.ToString(); decimal totalCost = duration * CostPerDay; return(CampgroundName.ToString().PadRight(15) + SiteId.ToString().PadRight(15) + MaxOccupancy.ToString().PadRight(15) + accessible.PadRight(12) + rvLength.PadRight(10) + utilities.PadRight(12) + $"{totalCost:C}"); }
protected override void OnInit(EventArgs e) { base.OnInit(e); Controls.Clear(); /* ignore validation if control **NOT** enabled */ if (!this.Enabled) { return; } /* add RequiredFieldValidator */ if (required) { _rfv = ControlFactory.GetRequiredValidator( this.ID, this.ValidationGroup ); Controls.Add(_rfv); } /* add RegularExpressionValidator */ if (!String.IsNullOrEmpty(regex)) { addRegexValidator(); } /* * client-side JavaScript character counter; **MUST** edit plugin file * to call on all server control(s) */ if (TextMode == TextBoxMode.MultiLine && MaxLength > 0) { Attributes.Add(ControlFactory.MAXLENGTH_ATTR, MaxLength.ToString()); Type cstype = this.GetType(); ClientScriptManager cs = Page.ClientScript; // verify web.config <appSettings> keys exist if (!string.IsNullOrEmpty(_jsPath)) { if (!cs.IsClientScriptBlockRegistered(cstype, _jsPath)) { Literal l = new Literal() { Text = String.Format(StringFormat.TAG_SCRIPT, _jsPath) }; Page.Header.Controls.Add(l); cs.RegisterClientScriptBlock(cstype, _jsPath, ""); } } } /* add CompareValidator */ AddCompareValidator(); /* client-side validation => ValidationGroup */ if (ValidationGroup != String.Empty) { Attributes.Add(ControlFactory.VALIDATION_GROUP_ATTR, ValidationGroup); } }
/// <summary> /// 最大多数のサーバーバリデーション時のエラーメッセージ取得 /// </summary> /// <param name="displayName">表示名称(DisplayNameアトリビュートで変更できる)</param> /// <returns>必須エラーメッセージ</returns> string GetOverMaxErrorMessage(string displayName) { if (string.IsNullOrEmpty(OverMaxErrorMessage)) { return(displayName + "の値が最大値「" + MaxLength.ToString() + "」を超えています。"); } else { return(OverMaxErrorMessage); } }
public override void Process(TagHelperContext context, TagHelperOutput output) { base.Process(context, output); RenderFieldHeader(context, output); var id = GetDomId(); output.Content.AppendHtml("<textarea data-target=\"aiplugs-textarea.textarea\" data-action=\"keydown->aiplugs-textarea#updateHeight\" data-val=\"true\""); if (id != null) { output.Content.AppendHtml($"id=\"{id}\""); } if (Name != null) { output.Content.AppendHtml($"name=\"{Name}\""); } if (Placeholder != null) { output.Content.AppendHtml($"placeholder=\"{Placeholder}\""); } if (Required) { output.Content.AppendHtml($"required data-val-required=\"{Localizer[SharedResource.VAL_MSG_REQUIRED, Label]}\""); } if (!string.IsNullOrEmpty(Pattern)) { var message = !string.IsNullOrEmpty(PatternErrorMessage) ? PatternErrorMessage : Localizer.MsgValPattern(Label, Pattern); output.Attr("data-val-regex", message); output.Attr("data-val-regex-pattern", Pattern); } if (MaxLength.HasValue) { output.Attr("data-val-maxlength", Localizer.MsgValMaxLengthForString(Label, MaxLength.Value)); output.Attr("data-val-maxlength-max", MaxLength.ToString()); } if (MinLength.HasValue) { output.Attr("data-val-minlength", Localizer.MsgValMinLengthForString(Label, MinLength.Value)); output.Attr("data-val-minlength-min", MinLength.ToString()); } output.Content.AppendHtml(">"); output.Content.Append(Value ?? ""); output.Content.AppendHtml("</textarea>"); RenderFieldFooter(context, output, Name); }
/// <summary> /// Used to populate ListView /// </summary> /// <returns></returns> public string[] ItemArray() { return(new[] { Name, SystemType.ToString(), MaxLength.ToString(), Precision.ToString(), Scale.ToString() }); }
override protected void OnPreRender(EventArgs e) { // Ensure default work takes place base.OnPreRender(e); // Configure TextArea support if ((TextMode == TextBoxMode.MultiLine) && (MaxLength > 0)) { // If we haven't already, include the supporting // script that limits the content of textareas. foreach (var script in ScriptIncludes) { var scriptManager = ScriptManager.GetCurrent(Page); if (scriptManager == null) { continue; } var absolutePath = VirtualPathUtility.ToAbsolute(script); scriptManager.Scripts.Add(new ScriptReference(absolutePath)); } // Add an expando attribute to the rendered control which sets its maximum length (using the MaxLength Attribute) /* Where there is a ScriptManager on the parent page, use it to register the attribute - * to ensure the control works in partial updates (like an AJAX UpdatePanel)*/ var current = ScriptManager.GetCurrent(Page); if (current != null && (current.GetRegisteredExpandoAttributes().All(rea => rea.ControlId != ClientID))) { ScriptManager.RegisterExpandoAttribute(this, ClientID, _maxLengthAttributeName, MaxLength.ToString(CultureInfo.InvariantCulture), true); } else { try { Page.ClientScript.RegisterExpandoAttribute(ClientID, _maxLengthAttributeName, MaxLength.ToString(CultureInfo.InvariantCulture)); } catch (ArgumentException) { // This occurs if a script with this key has already been registered. The response should be to do nothing. } } // Now bind the onkeydown, oninput and onpaste events to script to inject in parent page. Attributes.Add("onkeydown", "javascript:return LimitInput(this, event);"); Attributes.Add("oninput", "javascript:return LimitInput(this, event);"); Attributes.Add("onpaste", "javascript:return LimitPaste(this, event);"); } }
protected override void OnPreRender(EventArgs e) { if (MaxLength > 0) { Attributes.Add("onkeypress", "LimitInput(this)"); Attributes.Add("onbeforepaste", "doBeforePaste(this)"); Attributes.Add("onpaste", "doPaste(this)"); Attributes.Add("onmousemove", "LimitInput(this)"); Attributes.Add("maxLength", MaxLength.ToString()); } base.OnPreRender(e); }
/// <summary> /// Performs additional custom processes when writing customized attributes for html object in xsl template. /// </summary> /// <param name="writer">The XmlWriter to which you want to save xsl template.</param> protected override void OnWriteCustomAttributes(System.Xml.XmlWriter writer) { base.OnWriteCustomAttributes(writer); // "maxlength" attribute writer.WriteAttributeString("maxlength", MaxLength.ToString()); // "readonly" attribute if (ReadOnly) { writer.WriteAttributeString("readonly", "readonly"); } }
public void RenderInput(TagHelperContext context, TagHelperOutput output, string name, string value = null, bool target = true) { output.Tag("input", () => { output.Attr("type", "checkbox"); output.Attr("data-val", "true"); if (value != null) { output.Attr("value", value); } if (Pattern != null) { var message = !string.IsNullOrEmpty(PatternErrorMessage) ? PatternErrorMessage : Localizer.MsgValPattern(Label, Pattern); output.Attr("data-val-regex", message); output.Attr("data-val-regex-pattern", Pattern); } if (MaxLength.HasValue) { output.Attr("data-val-maxcount", Localizer.MsgValMaxLengthForArray(Label, MaxLength.Value)); output.Attr("data-val-maxcount-max", MaxLength.ToString()); } if (MinLength.HasValue) { output.Attr("data-val-mincount", Localizer.MsgValMinLengthForArray(Label, MinLength.Value)); output.Attr("data-val-mincount-min", MinLength.ToString()); } if (!MinLength.HasValue && Required) { output.Attr("data-val-mincount", Localizer.MsgValRequired(Label)); output.Attr("data-val-mincount-min", "1"); } if (target) { if (name != null) { output.Attr("name", name); } output.Attr("data-target", "aiplugs-tag-item.input"); output.Html(" checked "); } else { output.Attr("class", "aiplugs-tag__dummy val-ignore"); } }); }
public string ToDisplayString() { string nullable = Required ? string.Empty : "?"; string initial = !string.IsNullOrEmpty(InitialValue) ? $" = {InitialValue.Trim('"')}" : string.Empty; string lengthDisplay = ""; if (MinLength > 0) lengthDisplay = $"[{MinLength}-{(MaxLength > 0 ? MaxLength.ToString() : "")}]"; else if (MaxLength > 0) lengthDisplay = $"[{MaxLength}]"; return $"{Name}: {Type}{nullable}{lengthDisplay}{initial}"; }
public string ToSprocDatatype() { StringBuilder sb = new StringBuilder(Datatype.ToString()); if (_TextTypes.Contains(Datatype.ToLower())) { string max = (MaxLength == -1) ? "MAX" : MaxLength.ToString(); sb.Append(String.Format("({0})", max)); } //if (IsNullible) //{ // sb.Append(" = NULL"); //} return(sb.ToString()); }
/// <summary>Returns a string that represents the current object.</summary> /// <remarks>Output is, in order: /// <ul> /// <li>Visibility</li> /// <li>Type (with optional '?' if not a required field</li> /// <li>Max length in brackets, if a string field and length is specified</li> /// <li>Name (with optional '!' if an identity field</li> /// <li>an equal sign (=) followed by an initializer, if an initializer is specified</li> /// </ul> /// </remarks> /// <returns>A string that represents the current object.</returns> public override string ToString() { string visibility = SetterVisibility.ToString().ToLower(); string identity = IsIdentity ? "!" : string.Empty; string nullable = Required ? string.Empty : "?"; string initial = !string.IsNullOrEmpty(InitialValue) ? $" = {InitialValue.Trim('"')}" : string.Empty; string lengthDisplay = ""; if (MinLength > 0) lengthDisplay = $"[{MinLength}-{(MaxLength > 0 ? MaxLength.ToString() : "")}]"; else if (MaxLength > 0) lengthDisplay = $"[{MaxLength}]"; return $"{visibility} {Type}{nullable}{lengthDisplay} {Name}{identity}{initial}"; }
public override string ToString() { StringBuilder sb = new StringBuilder(ColumnName + " ("); if (IsPrimaryKey) { sb.Append("PK, "); } sb.Append(Datatype.ToString()); if (_TextTypes.Contains(Datatype.ToLower())) { string max = (MaxLength == -1) ? "MAX" : MaxLength.ToString(); sb.Append(String.Format("({0})", max)); } sb.Append((IsNullible) ? ", null)" : ", not null)"); return(sb.ToString()); }
public void SaveToXml(string filePath) { XmlDocument document = new XmlDocument(); XmlNode rootNode = document.CreateElement("CheckConfig"); rootNode.AppendChild(CreateNode(document, "SurfaceTolerance", SurfaceTolerance.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "ElevationTolerance", ElevationTolerance.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "CompareRadius", CompareRadius.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "CompareLimit", CompareLimit.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "ElevationCheckType", Enum.GetName(typeof(EnumElevationCheckType), ElevationCheckType))); rootNode.AppendChild(CreateNode(document, "ZxValue", ZxValue)); rootNode.AppendChild(CreateNode(document, "NxValue", NxValue)); rootNode.AppendChild(CreateNode(document, "StraightPnt", StraightPnt)); rootNode.AppendChild(CreateNode(document, "ThreeConnect", ThreeConnect)); rootNode.AppendChild(CreateNode(document, "FourConnect", FourConnect)); rootNode.AppendChild(CreateNode(document, "MultiConnect", MultiConnect)); rootNode.AppendChild(CreateNode(document, "PointMinimumSpacing", PointMinimumSpacing.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "LineMinimumSpacing", LineMinimumSpacing.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "MaxLength", MaxLength.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "GroundElevationMin", GroundElevationMin.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "GroundElevationMax", GroundElevationMax.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "DepthMin", DepthMin.ToString(CultureInfo.InvariantCulture))); rootNode.AppendChild(CreateNode(document, "DepthMax", DepthMax.ToString(CultureInfo.InvariantCulture))); XmlNode domainsNode = document.CreateElement("Domains"); foreach (DomainItem domainItem in _domainItems) { XmlNode domainNode = document.CreateElement("Domain"); XmlAttribute attribute = document.CreateAttribute("Name"); attribute.Value = domainItem.FieldName; domainNode.Attributes.Append(attribute); XmlNode valuesNode = document.CreateElement("Values"); foreach (string value in domainItem.ValueList) { valuesNode.AppendChild(CreateNode(document, "Value", value)); } domainNode.AppendChild(valuesNode); domainsNode.AppendChild(domainNode); } rootNode.AppendChild(domainsNode); document.AppendChild(rootNode); document.Save(filePath); }
public void WriteXmlSubtree(XmlWriter writer) { writer.WriteStartElement(XmlStrings.RndSymbolsGen); writer.WriteAttributeString(XmlStrings.NameAttr, Name); writer.WriteStartElement(XmlStrings.ParamsNode); writer.WriteAttributeString("min", MinLength.ToString()); writer.WriteAttributeString("max", MaxLength.ToString()); foreach (var s in Lines) { writer.WriteStartElement("lines"); writer.WriteString(s); writer.WriteEndElement(); // lines } writer.WriteEndElement(); writer.WriteEndElement(); }
private void VerifyCommonLogic() { _editorForm.ShouldSatisfyAllConditions( () => _tbTabIndex.Text.ShouldBe(TabIndex.ToString()), () => _tbMaxLength.Text.ShouldBe(MaxLength.ToString()), () => _tbDesignIcon.Text.ShouldBe(DesignIcon), () => _tbDesignLabel.Text.ShouldBe(DesignLabel), () => _tbHtmlIcon.Text.ShouldBe(HtmlIcon), () => _tbHtmlLabel.Text.ShouldBe(HtmlLabel), () => _tbPreviewIcon.Text.ShouldBe(PreviewIcon), () => _tbPreviewLabel.Text.ShouldBe(PreviewLabel), () => _tbRows.Text.ShouldBe(TextAreaRows), () => _tbCols.Text.ShouldBe(TextAreaColumns), () => _tbCssClass.Text.ShouldBe(CssClass)); VerifyCheckBoxList(); VerifyStyles(); }
/// <inheritdoc /> protected override void AddAttributesToRender(HtmlTextWriter writer) { if (!string.IsNullOrEmpty(Name)) { writer.AddAttribute("name", Name); } if (!string.IsNullOrEmpty(Value)) { writer.AddAttribute("value", Value); } if (!string.IsNullOrEmpty(Label)) { writer.AddAttribute("label", Label); } if (MaxLength > 0) { writer.AddAttribute("maxlength", MaxLength.ToString()); } base.AddAttributesToRender(writer); }
protected override void Render(HtmlTextWriter writer) { CssClass = CssClass + " validator"; if (MinLength > 0) { Attributes["minlength"] = MinLength.ToString(); } if (MaxLength > 0 && MaxLength > MinLength) { Attributes["maxlength"] = MaxLength.ToString(); } if (!string.IsNullOrEmpty(Group)) { Attributes["group"] = Group; } if (!string.IsNullOrEmpty(GroupMessage)) { Attributes["groupmessage"] = GroupMessage; } if (Required) { Attributes["required"] = Required.ToString(); } if (CustomFunction == null) { CustomFunction = Function.ToString(); } Attributes["function"] = CustomFunction; if (!string.IsNullOrEmpty(ControlToValidate)) { Attributes["validates"] = ControlToValidate; } base.Render(writer); }
/// <summary> /// Gets the restriction value in string in CultureInfo.CurrentUICulture. /// </summary> /// <param name="restrictionField">The facet to be retrieved.</param> /// <returns>The value in string.</returns> public virtual string GetRestrictionValue(RestrictionField restrictionField) { switch (restrictionField) { case RestrictionField.Pattern: return(Pattern); case RestrictionField.Length: return(Length.ToString(CultureInfo.CurrentUICulture)); case RestrictionField.MinLength: return(MinLength.ToString(CultureInfo.CurrentUICulture)); case RestrictionField.MaxLength: return(MaxLength.ToString(CultureInfo.CurrentUICulture)); default: Debug.Assert(false); return(string.Empty); } }
protected override async Task OnAfterRenderAsync(bool firstRender) { bool needUpdating; if (firstRender) { JsModule = await JsRuntime.InvokeAsync <IJSObjectReference>("import", "./_content/BlazorNumericTextBox/numerictextbox.js"); string toDecimalSeparator = ""; if (DecimalSeparator != ".") { toDecimalSeparator = DecimalSeparator; } await JsModule.InvokeVoidAsync("ConfigureNumericTextBox", new string[] { "#" + Id, ".", toDecimalSeparator, SelectOnEntry ? "true" : "", MaxLength.ToString(), KeyPressCustomFunction }); await SetVisibleValue(Value); needUpdating = true; } else { needUpdating = !PreviousValue.Equals(Value); } if (needUpdating) { await SetVisibleValue(Value); PreviousValue = Value; } }
/// <summary> /// マウスクリックイベントオーバーライド /// </summary> protected override bool InputValue() { bool res = false; if (!readOnly) { string msgfmt = CommonProc.MessageText("G003"); msgfmt = msgfmt.Replace("%param", paramName); msgfmt = msgfmt.Replace("%length", MaxLength.ToString()); if (AllowJapanese) { CustomDialog.IMEInputTextDialog tdlg = new CustomDialog.IMEInputTextDialog(); tdlg.InputText = Text; tdlg.Caption = msgfmt; tdlg.MaxLength = MaxLength; if (tdlg.ShowDialog() == DialogResult.OK) { Text = tdlg.InputText; res = true; } tdlg.Dispose(); } else { CustomDialog.KeyboardDialog kdlg = new CustomDialog.KeyboardDialog(); kdlg.InputArea = Text; kdlg.Message_Text = msgfmt; kdlg.DispMode = 0; //テキスト kdlg.AllLength = MaxLength; if (kdlg.ShowDialog() == DialogResult.OK) { Text = kdlg.InputArea; res = true; } kdlg.Dispose(); } } return(res); }
protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { string toDecimalSeparator = ""; if (DecimalSeparator != ".") { toDecimalSeparator = DecimalSeparator; } await JsRuntime.InvokeVoidAsync("ConfigureNumericTextBox", new string[] { "#" + Id, ".", toDecimalSeparator, UseEnterAsTab ? "true" : "", MaxLength.ToString() }); await JsRuntime.InvokeVoidAsync("SetNumericTextBoxValue", new string[] { "#" + Id, VisibleValue }); } }
private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { bool _IsValid = true; var _item = ((TextBox)sender).Text; if (string.IsNullOrEmpty(_item)) { InvalidNoticeText = "不能为空文本"; _IsValid = false; } else if (_item.Length >= MaxLength) { InvalidNoticeText = "不能超过" + MaxLength.ToString() + "个字符"; ((TextBox)sender).Text = _item.Substring(0, MaxLength); _IsValid = false; } else { InvalidNoticeText = ""; _IsValid = true; } IsValid = _IsValid; }
public string getFieldAccess() { return(getFieldAccess(Name, TypeField, NumPrecision.HasValue ? NumPrecision.ToString() : "" , NumScale.HasValue ? NumScale.ToString() : "", MaxLength.HasValue ? MaxLength.ToString() : "" , !Request, Default, AutoNumber)); }
/// --------------------------------------------------------------------------- /// <summary>Parses values for enum</summary> /// --------------------------------------------------------------------------- static public string ParseType(MaxLength value) { return ParseType(value.GetType().ToString(), value.ToString()); }