RequiredFieldValidator替换跨度 [英] RequiredFieldValidator replacing span
问题描述
晚上好,人们
我在实现RequiredFieldValidator时遇到了一些问题.或者...在实施之后再进行配置就没有什么问题了.
我设计了如下形式的表格
good evening folks
i've got a little problem on implementing the RequiredFieldValidator. Or... less a problem on implementing then on congurating.
I Designed a form like the following
<form>
<table>
<tr>
<td>Name*</td>
<td><input type="text" id="name" runat="server" /></td>
</tr>
<asp:RequiredFieldValidator
ControlToValidate="name"
runat="server"
ErrorMessage="Please enter a name"
Display="Dynamic">
<tr><td colspan="2" class="error">Please Enter a name</td></tr>
</asp:RequiredFieldValidator>
</table>
</form>
结果是以下html
This results in following html
<tr>
<td>Name*</td>
<td><input name="ctl00$Content$lastname" type="text" id="ctl00_Content_lastname" /></td>
</tr>
<span id="ctl00_Content_ctl01" style="color:Red;display:none;">
<tr><td colspan="2" class="error">Bitte geben Sie Ihren Nachnamen ein</td>
</tr>
</span>
问题是,跨度内的tr元素是不允许的.问题在于,这样就不会隐藏表行.
现在,我的问题是,是否可以配置RequiredFieldValidator,以便他创建一个tr元素而不是一个span或更佳的选择,不会在tr周围创建任何元素.
是否可以通过简单的方式实现?还是我必须重新实现Validator?
greez
crazy_crank
PS:不太确定它的线程是否正确...如果不是,请直接移动
Problem is, that a tr element inside a span isn't allowed. Problem on that is, that in this way the table-row is not hidden.
My question is now, if it's possible to configure the RequiredFieldValidator, so that he creates a tr element instead of a span, or better, it doesn't create any element arround my tr.
Is this possible in a simple way, or will I have to reimplement the Validator?
greez
crazy_crank
PS: Not quite sure if its the correct thread... just move if not
推荐答案
crazy_crank,
我会移动它的,但不幸的是,ASP.NET论坛站点位于与该站点断开连接的完全不同的网站上.它位于 http://forums.asp.net/,我相信他们将能够在这里为您提供更好的帮助.在Visual C#语言中,ASP.NET问题是题外话.
Hi crazy_crank,
I would move it, but unfortunately, the ASP.NET forums site is on a completely different website disconnected from this one. It's located at http://forums.asp.net/, and I believe they'll be able to help you better there. ASP.NET questions are off-topic in Visual C# Language.
这篇关于RequiredFieldValidator替换跨度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!