You can show validation messages in popup/message box. You just need to have a validation summary control and add these properties:
ShowMessageBox="true"
ShowSummary="false"
It will display all validation messages in popup alert window, without using javascript.
How to show validations in messagebox/popup using ASP.NET Example:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >
<html>
<body>
<form id="Form1" runat="server">
<h4>
Popup Validation Summary Example</h4>
<br />
Enter UserName Name:
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtUserName"
runat="server" ErrorMessage="Please Enter User Name" InitialValue="" Text="*" />
<br />
Enter Password:
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtPassword"
runat="server" ErrorMessage="Please Enter Password" InitialValue="" Text="*" />
<br />
<asp:Button ID="Button1" Text="Submit" runat="server" />
<br />
<br />
<asp:ValidationSummary ShowMessageBox="true" ShowSummary="false" ID="ValidationSummary1" HeaderText="You must enter a value in the following fields:"
DisplayMode="BulletList" EnableClientScript="true" runat="server" />
</form>
</body>
</html>
0 comments:
Post a Comment