Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Thousands of businesses have used Microsoft ASP.NET to build professional, dynamic websites. In this course, web developer David Gassner demonstrates the tools needed to build and deploy a dynamic site using ASP.NET 3.5 or 4.5. Covering everything from installing and configuring Visual Web Developer 2008 or Visual Studio Express 2012 for Web and SQL Server Express to creating web form pages, this course is designed to give beginning and intermediate developers hands-on experience.
The ASP.NET Framework includes a control called the Validation Summary. The purpose of the Validation Summary is to collect all of the error messages generated by all of the validators within a particular page, and then to display those messages in a single location on the page. For this demonstration I'll use a file called TitleInsertValidationSummary.aspx. In the current version of the page there are three validator controls. Two of them on the Price field and one on the PubDate. If I simply click the Insert link, I'll see the error message for the price displayed. And if I type in a non-date value like xyz, I'll also see the validator for the pubdate displayed.
By using the Validation Summary, I'll collect these messages and display them in a single bullet list below the form. I'll close the browser and return to Visual Web Developer. The first step is to suppress the automatic output of the validator controls. I'll go to each of the validator controls in Source View and I'll change the Value of the validator controls Display property from Dynamic to None. And I'll do the same thing for the RangeValidator for price. And I'll also do the same thing for the RangeValidator for the pubdate.
Now if the form is displayed and the user makes errors, they won't see any messages at all. So here is how we replace that functionality. I'll look at the page in Design View and then I'll go to the Toolbox panel. One of the items in the Toolbox panel is called Validation Summary. Pin the Toolbox panel into place if it isn't already pinned, and then click into the paragraph to the right of the Details View and press Enter to create a new paragraph. Then drag the Validation Summary and place it in the empty paragraph. Notice that the Validation Summary by default displays in a bullet list. Now save your changes and run the page in the browser.
I will click the Insert link and show that the error message is now displayed below the form. And if I type in a non- date value into the PubDate filed and click Insert, I'll see both of the error messages displayed together. From this point on everything else is just a matter of simple formatting. If you don't like the extra space below the form eliminate any extra paragraphs. If you don't like the color, background, or anything else about the way that the control is displaying the error messages, create a Cascading Style Sheet class and set the CssClass property of the Validation Summary control to use that class. This way you can create a common interface for your entire website without having to set the same properties over-and-over.
So again, the purpose of the Validation Summary is to collect all of the error messages from all validator controls that are outputting them in a single page. You have to expressly suppress the output of the individual validator controls by setting their display property to None. And then add your Validation Summary wherever you wanted to display on your webpage.
Find answers to the most frequently asked questions about ASP.NET Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.