简体   繁体   中英

asp.net Web Form custom error messages for each element

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

For jQuery, I recommend the jQuery Validation Plugin .

For ASP.NET AJAX, I recommend the ValidatorCallout .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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