Lookup lists with NHibernate and ASP.Net MVC -


I can not assume a selection list to populate the value of the original object I am using a wrapper object So that I should be used to bind myself so that I need the value of the selection list along with the required value of the value that is required. I'm betting that I'm missing something basic, but I'm not getting it.

I have these models:

  public class status {public virtual ID {receipt; Protected Set; } Public Virtual String {get} Set; } Public Virtual Boole isClosed {get; Set; } Public override string toasting () {return name; }} Public class issued {public virtual id id {get; Protected Set; } Public Virtual String Title {get; Set; } Public Virtual String Description {get; Set; } Public virtual status status {received; Set; } Created public virtual date time {at; Set; } Public Virtual Date Time Updated {Received; Set; }}  

and Statuses

  public class IssueFormViewModel {public issue issue {get; Set; } Receive public selection list status { Set; } Public IssueView Model (Issue Issue, ILIIT & Lt; Status & gt; Positions) {Issue = Problem; Status = New Selection List (Statuses, "ID", "Name", Conditions [1]. ID); } Public IssueFormViewModel () {}}  

Looks like creating actions on my controller ...

  Create public actions () {IList & lt ; Status & gt; Conditions; Problem issue = new issue (); // A list of NHibernate accessories & lt; Status & gt; See refund (new issueformmodel (issue, position)); } [AcceptVerbs (HttpVerbs.Post)] Create Public Functionality (IssueFormViewModel issueFormView) {// FormView.Issue.Status == Zero at this Point Issue = ... Zero // ...}  

My Points Object Try partially using these names:

  & lt; P & gt; & Lt; Label = "Issue.Title" & gt; Title: & lt; / Label & gt; & Lt;% = Html.TextBox ("Issue.Title", Model.Issue.Title)%> & Lt;% = Html Validation message ("title", "*")%> & Lt; / P & gt; & Lt; P & gt; & Lt; Label = "status" & gt; Status: & lt; / Label & gt; & Lt ;! - also tried "issue. Status" - & gt; & Lt;% = Html.DropDownList ("Status", Model Location)%> & Lt;% = Html Verification Message ("Status", "*")% & gt; & Lt; / P & gt; I tried the dropdown list on my computer and it works, you should ensure that NHibernate is returning more than 1 item because your code is trying to set the selected item as a second item.    Status = New selection list (status, "id", "name", position [1]. Id);  

Remember that a again zero-based index is.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -