c# - Creating an edit form using ASP.Net MVC 2 scaffolding -


I have the following code that was generated using the scaffold and IDJefe is an integer in my database, but I want to Choose a name from the end user combo box.

How can I complete this?

  & lt;% @ page title = "" language = "c #" masterpagefile = "~ / view / shared / site.master" inheritance = "system.web.mvc pagepace & lieutenant ; SeguimientoDocente.Area & gt; "& Gt%; & Lt; Asp: Content ID = "Content1" content placeholder ID = "TitleContent" runat = "server" & gt; UTPSA | Edit area & lt; / Asp: Content & gt; & Lt; Asp: Content ID = "Content2" content placeholder id = "main content" run = "server" & gt; & Lt; H2 & gt; Edit area: & lt;%: Model.Nombre% & gt; & Lt; / H2 & gt; Use of & lt;% (Html.BeginForm ()) {%> & Lt;%: HTML Valid (% true)% & gt; & Lt; Fieldset & gt; & Lt; Legend & gt; Information Detallada de Area | | & Lt;%: Model.Nombre% & gt; & Lt; / Legend & gt; & Lt; Div class = "editor-label" & gt; & Lt;%: HTML.LabelFor (model = & gt; model.Nombre)% & gt; & Lt; / Div & gt; & Lt; Div class = "editor-field" & gt; & Lt;%: Html.TextBoxFor (model = & gt; model.Nombre)% & gt; & Lt;%: HTML Validation message (Model = & Model; Model Number)% & gt; & Lt; / Div & gt; & Lt; Div class = "editor-label" & gt; & Lt;%: HTML.LabelFor (Model = & gt; Model. IDJF)% & gt; & Lt; / Div & gt; & Lt; Div class = "editor-field" & gt; & Lt;%: Html.TextBoxFor (Model = & gt; Model. IDJefe)% & gt; & Lt;%: HTML Validation message (Model = & gt; Model. IDJ)% & gt; & Lt; / Div & gt; & Lt; P & gt; & Lt; Input type = "submit" value = "save" /> & Lt; / P & gt; & Lt; / Fieldset & gt; & Lt;%}% & gt; & Lt; Div & gt; & Lt;%: Html.ActionLink ("A list normal", "index")%> & Lt; / Div & gt; & Lt; / ASP: Content & gt;  

I have not availed any of the following.

  & lt;%: HTML.DropDownList (Model.Jefes ????%>  

I can do something like this, but one Creating a new object for a simple object like it looks garbage.

  Edit public functioning (int id) {area area = regional repository.GateArea (ID); JefeRepository jefe = New JefeRepository (); ViewData ["Jefes"] = New SelectList (jefe.FindAllJefes (), Area. Jefe.Nombre) Return View (Area);}  

Any Better Way ?

You can see the editor templates here is an example that looks like what you want to do:

EDIT: To create a partial view in it and call that view Using data comments is included:

  & lt;% @ Control language = "C #" Inherits = "System.Web.Mvc.ViewUserControl & lt; string & gt;"% & Gt; & lt;% = Html.DropDownList (see "New Seal CTList (string []] Data [" Rating "], Model)% & gt;  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -