如何设置自定义验证器的宽度

发布于 2024-08-20 18:47:03 字数 221 浏览 4 评论 0原文

有谁知道如何设置自定义验证器的宽度,以便错误消息文本在超过指定宽度时将换行?

我有一个用户控件,其中包含一个自定义验证器,包含页面可以根据特定验证结果设置错误消息。

用户控件位于页面中的表格单元格内。

如果消息很长,它只会将整个消息打印在一行上,忽略设置的任何列宽。

感谢您的任何见解。

编辑: 我尝试在自定义验证器本身上设置宽度属性,但无济于事。

Does anybody know of a way to set the width of a custom validtor so that the error message text will wrap if it exceeds the specified width?

I have a user control that contains a custom validator which the containing page can set the error message on based on specific validation results.

The user control sits within a table cell in a page.

If the message is very long it simply prints the entire message on a single line ignoring any column widths that are set.

Thanks for any insight.

EDIT:
I have tried setting the width property on the custom validator itself to no avail.

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

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

发布评论

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

评论(2

朦胧时间 2024-08-27 18:47:03

将它放在另一个元素中,您可以控制...的样式,就像它自己的 div 具有您指定的类一样。

Put it inside another element you can control the style of... like it's own div with a class you specify.

惜醉颜 2024-08-27 18:47:03

如果用户控件的定义使得错误消息出现在 div 内,请尝试设置该 div 元素的宽度。

如果您的控件是这样的,

<asp:TableCell id="some1" runat="server">
    <uc:yourControl id="uc1" runat="server" />
</asp:TableCell>

请修改控件以包含消息的 div 或 span 元素。

If the user control is defined such that the error message appears inside a div, try to set the width of that div element.

If your control is in something like this

<asp:TableCell id="some1" runat="server">
    <uc:yourControl id="uc1" runat="server" />
</asp:TableCell>

Modify the control to have a div or span element for the message.

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