spark view engine - ASP.NET MVC1 - Not all Request fields being returned in Model... (NOOB question) -


I am working on my first ASP.NET MVC project, and when I return data from any data, weird behavior See Viewing View of my Administrator in action.

Right now, I have 3 text boxes on the page, as well as for a hidden PK. I is all being properly populated with vendetta, but when I submit the form, 3 Out of the models are shown in only 2 returned models. However, all three areas are properly populated in the requested object.

I may not have understood this very well, but hopefully it shows some fair code:

  edit public functioning (System.Guid Id) {SetBase sb = setBaseRepository.Get (Id); See Return ("Edit", SB); } [AcceptVerbs (HttpVerbs.Post)] Edit Public Functionality (SetBase Setbase) {// if (setBase.Title.Trim (). Length == 0} // {// ModelState.AddModelError ("title", "title Is necessary "). //} if (setBase.Year.Trim (). Length == 0) {ModelState.AddModelError ("year", "year is required."); } If (ModelState.IsValid) {Return View ("Edit", Setbase); } SetBaseRepository.SaveOrUpdate (setBase); See Return (); }  

And here is the 'meat' of your own:

  & lt; Viewdata model = "CardTracker.Core.SetBase" & gt; & Lt; Content name = "main content" & gt; & Lt;% MvcForm Form = Html.BeginForm ("Edit", "SetBase", Model.Id); & Gt%; & Lt;% = HTML.ValidationSummary ("Update was unsuccessful. Please fix the errors and try again.", New {class = "dataEntryError"})%> & Lt; Fieldset & gt; & Lt; Legend class = "datentry" & gt; Set set base & lt; / Legend & gt; & Lt; Div & gt; ! {HTML.Hidden ("Id")} for label = "dataEntry" = "title" & gt; Title: & lt; / Label & gt; $ {Html.TextBox ("title", model.title, new {class = "dataEntryLong"}}} <% = HTML.ValidationMessage ("title", "***", new {class = "dataEntryError" }}%>  Input Type = "Submit" value = "Update" class = "Button" />   (); & Gt;; & lt; / content & gt;  

The 'id' and 'year' fields are returned exactly, but 'head The 'always' is always empty empty. I have verified that all of them are spelled correctly.

I am sure I am doing something wrong, but I do not see it. Those I have read, they are not helping, and most of them add functionality instead of editing.

Thank you in advance for any and all help.

I started listing those things and Class I, I notice that I, until I could not really help me, the title field is the only area that actually reference model. Your year field is zero for the initial value; I do not really understand this, but this is the only difference I can see.

  • I'm just trying to find out the case of weird edge, so I'm making sure that the "SetBase" value is BeginForm ("Edit", "Setbase", Model.id) Saying? This is the name of your model, which is clearly okay, but wanted to make sure that it is the name of the controller.
  • ... everything is fine, but obviously something is wrong.


    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 -