Mega Code Archive
Categories
/
ASP.Net Tutorial
/
Validation
RequiredFieldValidatorSummary DisplayMode
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default_aspx" %>
Required Field Validation
-- Please Pick A Book --
Programming ASP.NET
Programming .NET Windows Applications
Programming C#
Programming Visual Basic 2005
Teach Yourself C++ In 21 Days
Teach Yourself C++ In 24 Hours
TY C++ In 10 Minutes
TY More C++ In 21 Days
C++ Unleashed
*
1st
2nd
3rd
4th
*
*
Summary
Msg. Box
List
Bulleted List
Single Paragraph
File: Default.aspx.cs using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Default_aspx : System.Web.UI.Page { protected void btnSubmit_Click(object sender, EventArgs e) { if (Page.IsValid) { lblMsg.Text = "Page is Valid!"; } else { lblMsg.Text = "Some of the required fields are empty"; } } protected void lstFormat_SelectedIndexChanged(object sender, EventArgs e) { ValSum.DisplayMode = (ValidationSummaryDisplayMode) lstFormat.SelectedIndex; } protected void lstDisplay_SelectedIndexChanged(object sender, EventArgs e) { ValSum.ShowSummary = lstDisplay.SelectedIndex == 0; ValSum.ShowMessageBox = lstDisplay.SelectedIndex == 1; } }