每个元素的 asp.net Web 窗体自定义错误消息 [英] asp.net Web Form custom error messages for each element

查看:20
本文介绍了每个元素的 asp.net Web 窗体自定义错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 Web 应用程序 - 表单,以及后端 SQL 插入和查询.

目前我正在显示所有用户错误消息:-

 

<asp:DataList ID="dtlERA_Errors" runat="server" Visible="false"><项目模板>——<asp:Label ID="Label4" runat="server" Text='<%#Eval("Description") %>'></asp:Label></ItemTemplate></asp:DataList>

这个 div 位于我的 aspx 页面的底部,它按顺序列出了所有错误.

然而,我的目标是为每个元素创建自定义错误消息,显示在元素旁边(比如文本框),带有 *,然后是自定义错误消息.我已经看到很多现代网络表单都应用了这种技术.

这是基于 ajax/jquery 的吗....谁能给我提供一些我应该研究的文献或名称(库)?我会很感激的.

解决方案

你应该仔细阅读 asp.net 验证控件

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

I have created a web application - form, along with backend SQL insertions and queries.

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.

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.

Is this ajax/jquery based.... Can anyone provide me with some literature or a name (library) that I should look into? I would appreciate this.

解决方案

You should read up on asp.net validation controls

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

这篇关于每个元素的 asp.net Web 窗体自定义错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆