为什么 AjaxControlToolkit TabContainer 呈现所有自定义控件标记属性?

发布于 2024-11-19 06:04:24 字数 1775 浏览 2 评论 0 原文

这是一个解释起来很奇怪的问题,但希望我能说得通。

我们的组织拥有一个在解决方案中使用的自定义控件库。这些控件的一个示例是与一组验证器组合的文本框,可以通过标记中设置的属性来适当配置这些验证器。

现在,我在 TabContainer 中使用此控件(我相信已经缩小了范围)时遇到了问题。

如果我想在容器中使用以下标记:

当我保存或重新加载 .aspx 标记时,它会为同一控件呈现以下标记:

除了现在在标记中呈现的属性覆盖实际控件的默认功能之外,这不会是一个问题。在这种情况下,默认电子邮件地址正则表达式将被忽略,因为属性“ValidationExpression”被设置为空字符串!

我可以再次将默认正则表达式放置在该属性中,但我只是想了解为什么标记会以这种方式运行?

谢谢。

This is a strange one to explain but hope I make sense.

Our organisation has a library of custom controls that we use in our solutions. One example of these controls is a textbox combined with a set of validators which can be configured appropriately by its properties set in the markup.

I now have a problem when using this control in (which I beleive to have narrowed it down) a TabContainer.

If I wanted to use the following markup in the container:

<scc:TextBox ID="txtEmailAddr" runat="server" CssClass="input EmailAddress" EnforceEntry="EmailAddress"
ErrorMessage_RequiredFieldNotCompleted="" ErrorMessage_ShowExclamation="true"
MaxLength="150" ShowErrorMessageBelow="false" Label="Email Address " />

When I save or reload the .aspx markup it then renders the following markup for the same control:

<scc:TextBox ID="txtEmailAddr" runat="server" CssClass="input EmailAddress" EnforceEntry="EmailAddress"
ErrorMessage_RequiredFieldNotCompleted="" ErrorMessage_ShowExclamation="True"
MaxLength="150" ShowErrorMessageBelow="False" Label="Email Address "
ClientSidePreventInvalidChars="True" EnableClientScript="True"
EnfoceOnPaste="False" EnforceMaxLengthWithRXOnMultiline="True"
EnforceOnPaste="False" EnforceSpaceInPostcode="True"
ErrorMessage_InvalidFormat="Email Address : Please enter a valid email address"
ErrorMessage_NumericValueInvalidOrOutOfRange="Email Address requires a number to be entered in the range to ."
GuidanceText="" GuidanceText_RenderInMouseoverPanel="False"
JavascriptURL="~/Include/TextBoxMaximumLength.js" LabelBold="False"
LabelCSSClass="" MaxValue="9999999" MinValue="-9999999" Read_Only="False"
RememberAnswer="False" RenderInParagraphs="True"
RenderRequiredTextForRequiredFields="True" Required="True"
RequiredField_InitialValue="" Rows="0" ShowMaxLength="False" Text=""
TextBox_TabIndex="0" TextboxSkinID="" TextMode="SingleLine"
TooltipPopup_BodyText="" TooltipPopup_TooltipText="(guidance)"
ValidationGroup="" ValidationExpression="" />

This would not be a problem other than the properties that are now being rendered in the markup are overriding default functionality of the actual control. In this case the default Email Address regular expression is being ignored because the property 'ValidationExpression' is being set to an empty string!

Again I could place the default regex in that property, but I would just like to understand why the markup is behaving in this manner?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撩起发的微风 2024-11-26 06:04:24

获取 AjaxContolToolkit 的代码并单步执行它以了解呈现所有属性的原因。您可以根据需要调整该代码并编译 dll 并使用它。根据个人经验,由于您所描述的行为,这是我发现该工具包有用的唯一方法。

Get the code for the AjaxContolToolkit and step through it to see why all properties are rendered. You can adjust that code as you need and compile the dll and use that. From personal experience, that is the only way I have found use for the Toolkit because of behaviors like you describe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文