Example of using HTML forms with Sparkview engine on ASP.NET MVC2 -


I'm playing with MVC2 on ASP.NET 4.0 with Sparkview 1.0. Trying to create a simple HTML form.

When the form loads, it renders as expected. Click on the Save button on the form, the model validates, gives an error about the length of the field (expected), but then ! {Model.Name} tag is presented as $ {Model.Name} text, instead "Test blah blah"

Where can I find an example of creating HTML forms using HTML helpers with SparkView?

 ! {Model.Name} $ {Html.ValidationSummary ("Edit was unsuccessful. Please fix the errors and try again.")} # Html.BeginForm (); & Lt; Fieldset & gt; & Lt; Story & gt; Fields & lt; / Narrative & gt; & Lt; P & gt; & Lt; Label = "name" & gt; Name: & lt; / Label & gt; ! {Html.TextBox ("name", Model.Name)} & lt; / P & gt; & Lt; P & gt; & Lt; Input type = "submit" value = "save" /> & Lt; / P & gt; & Lt; / Fieldset & gt; #Html.EndForm ();  

And here is the controller method:

  [HTTP post] Add Public Actioncell (Project Project) {if (ModelState.IsValid) {// save to DB Response Redirect ("/"); } View Data ["Model"] = Project; See Return (); } 

Model SPARC has a special name, it represents a strongly typed model for you .

Therefore, you can either change the name of your dictionary key other than the model (this is called "see" ["super model"]) or typed strongly of the visual method Returns the view-load surcharges.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -