I have a weird one. I’m trying to render out a standard textarea simply using the TextArea helper:
<p>
<label for="Message">Message:</label>
${ Html.TextArea("IssueText") }
${ Html.ValidationMessage("IssueText", "*") }
</p>
And my controller
public ActionResult Contact() {
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Contact(FormCollection form) {
Seller user = _session.AuthenticatedSeller;
ServiceTicket ticket = new ServiceTicket(user, form["IssueText"],
form["ContactReason"]);
if (ticket.IsValid) {
_servicetTicketRepository.Add(ticket);
_servicetTicketRepository.Commit();
return RedirectToAction("Index", "MyPlace");
}
ModelState.AddModelErrors(ticket.GetRuleViolations());
return View();
}
And on the first load of the page it works just fine and renders the textarea
Before http://cadred.net/personal/contact-before.png
However, when I submit the form to test validation it no longer renders the textarea
The reason you are getting the spark code instead of the test area is due to a null ref exception occurring when it is trying to execute the html.textarea related statements.
Rework your view as follows and you will be able to break into the view code generated by spark in a debugger.
Now you can F5 the project and you should get a dialog asking to launch a debugger when you hit the view, ignore it the first time ( hit No ) and launch a debugger the second time ( after you hit submit ). The list should include the VS instance you ran the project from, select that and away you go.
Look for nulls otherwise drop breakpoints in the try catch that renders the text area and in the catch handler for it. Hopefully you will get sufficient info to enable you to determine whats happening.