You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .

I have the book in front of me. I have the latest WebMatrix3, and I have tried everything, to re-installs to redoing the code and taking care of spellings (I know that C# is case sensitive). I'm at a loss as to why it doesn't work. I even put the output on the screen (variables and outputs from the functions; debugging technique) as the program is running. Am I missing declarations of some kind (Using statements etc.)? Do I need MVC or other packages? I know this is a simple program (as a computer programmer, I always tried to "Keep it simple stupid").

My program is kasta, and directly under that is App_Code folder, folder App_data, bin folder, Content folder, Images folder, Shared folder. _PageStart.cshtml, Default.cshtml, favicon.ico, Sell.cshtml and Web.config, all in the root.

For some reason, the helper functions Selected and Checked don't show up as methods (Intellisense...Helpers.cshtml file). The program runs; until I click on the Sell nav bar then I get the "context" error.

You seem to have omitted @Html.ValidationMessage("email"), which is the placeholder for the email validation message. It should appear just under the following line of code:

<input type="text" name="email" value="@Request["email"]" />

Imar or Mike:

I get string truncation errors while validating a comment text area using jquery (accordion) code and it seems my problem was related to the placement of the validation summary code.
When I enter text over the 250 char limit, into a text area comment (code set for > 250 char) I get the ugly error message, but not the validation warning.

I have increased the database column length of the question's comments to 950, which helps to 950 characters, but the validation is still failing at 200 characters.

Update Later Today:
I just VPN'd in to work and after checking my code on my machine at work and the book in Chapter 5 page 134 in the TRY IT OUT step #5, I noticed there are separate <div></div> tags and one set of <div></div> tags for the textarea with the name description. As you can see in my code below, my Q22Comments validation @Html.ValidationMessage("Q22Comments") is within and part of <DIV id="Radios22">. So, I will put my Q22Comments textarea between <div></div> tags and give it another go tomorrow. I could do it and test it via my VPN connection, but I need a (wife) life!

The <div> tags shouldn't matter; however, the summary should go below the code that adds the errors.

Cheers,

Imar

Yeah thanks! I "fingered" that out today.
<div> tag placement and surrounding the comments in div tags with named ID's didn't matter.
So will plunk the summary below the code that adds the errors and see if that does it.

Thinking about asking the "client" if comments are really needed, hate to do that though.

Really frustrating, in that the radio buttons validate just fine, but comments don't. I'll eventually get it figured out.
I'm working on this code in Visual Studio 2010 and hope to get it into a dev/int/prod environment once the validation is fixed.

I "pulled" this code into Visual Studio and while I'm glad the WebMatrix is editable and runs with VS, wish I'd written this exam in Visual Studio in native ASP.net as the coding resources seem more robust. Also, I'm being distracted from finishing your ASP.NET 4.5.1 book (up chapter 13 GridView and SqlDataSource Controls), which is going very well.

>> Really frustrating, in that the radio buttons validate just fine, but comments don't. I'll eventually get it figured out.

Can you post the full code for the page?

Imar

Yes and will do from work tomorrow!

Thanks!

OK here is the code...

Sorry about no line numbers. I bolded the code for the validation summary and where I think the code issue exists with comments for question 1. I'm using @HTML validation for comments, which may be the problem as maybe using @Helpers might fix things for comment validation. Opened this file is VS 2010 and could not get line number so display. Must not be requesting numbers in the right place.