简体   繁体   English

每个元素的asp.net Web窗体自定义错误消息

[英]asp.net Web Form custom error messages for each element

I have created a web application - form, along with backend SQL insertions and queries. 我创建了一个Web应用程序-表单,以及后端SQL插入和查询。

Currently I am displaying all user error messages:- 目前,我正在显示所有用户错误消息:

    <div style="padding: 1em;">
                <asp:DataList ID="dtlERA_Errors" runat="server" Visible="false">
                    <ItemTemplate>
                        -
                        <asp:Label ID="Label4" runat="server" Text='<%#Eval("Description") %>'></asp:Label></ItemTemplate>
                </asp:DataList>
   </div>

this div is at the bottom of my aspx page and it lists all errors in order. 这个div位于我的aspx页面的底部,并且按顺序列出了所有错误。

However my goal is to create custom error messages for each element, displayed next to the elements (say a textbox) with a * and then the custom error message. 但是,我的目标是为每个元素创建自定义错误消息,并在带有*的元素(例如文本框)旁边显示,然后显示自定义错误消息。 I have seen a lot of modern web forms apply this technique. 我已经看到许多现代的Web表单都采用了这种技术。

Is this ajax/jquery based.... Can anyone provide me with some literature or a name (library) that I should look into? 这是基于ajax / jquery的吗?...任何人都可以向我提供一些我应该研究的文献或名称(库)吗? I would appreciate this. 我将不胜感激。

You should read up on asp.net validation controls 您应该阅读asp.net验证控件

http://msdn.microsoft.com/en-us/library/aa479013.aspx http://msdn.microsoft.com/en-us/library/aa479013.aspx

For jQuery, I recommend the jQuery Validation Plugin . 对于jQuery,我建议使用jQuery Validation Plugin

For ASP.NET AJAX, I recommend the ValidatorCallout . 对于ASP.NET AJAX,我建议使用ValidatorCallout

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM