c# - How to create or render a List of entity for another entity in ASP.NET MVC 5? -


How can I provide a list of tags (metrics) for the location of this model in my application:

I am using entity framework 6.1.

I want to save a list of tags against a place and look back in it and I'm not able to do it!

  Public class tag {[key] [Database Generated (Database Generated Opinion. IDTT)] Public Virtual Ent ID {Received; Set; } Public Virtual String {get} Set; } // Navigation Public Virtual Location Location {get; Set; }} Public Square Location {[Key] [Database Generated (Database Generated Operation Identity)] Public Virtual In Place Locations {Received; Set; } Public virtual string locale {get; Set; } // Navigation Public Virtual List & lt; Tag & gt; Tags {get; Set; }}   

Right now this view has the input name of the input:

Create a View-Space

  & lt; H2 & gt; Create & lt; / H2 & gt; @using (Html.BeginForm ()) {@ Html.AntiForgeryToken () & lt; Div class = "form-horizontal" & gt; & Lt; H4 & gt; Location & lt; / H4 & gt; & Lt; Hour / & gt; @html Validity valid (true, new, {@ class = "text-danger"}) & lt; Div class = "form-group" & gt; @ Html.LabelFor (model = & gt; model.LocationName, html elevates: new {@class = "control-label col-md-2"}) & lt; Div class = "col-md-10" & gt; @ Html.EditorFor (model = & gt; model.LocationName, new {htmlAttributes = new {@class = "form-control"}}) @html. Validation message (model = & gt; model.LocationName, "", new {@class = "text-hazard"}) & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "form-group" & gt; @HTMLLabelFor (model = & gt; model.html tags, html atives: new {@class = "control-label col-md-2"}) & lt; Div class = "col-md-10" & gt; @ Html.TextBoxFor (model = & gt; model tags, new {html properties = new {@ class = "form-control"}}) @html. Validation message (model = & gt; model tag, "new", {@ class = "text-hazard"}) & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "form-group" & gt; & Lt; Div class = "col-md-offset-2 col-md-10" & gt; & Lt; Input type = "submit" value = "create" class = "btn btn-default" /> & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; }  

It provides fine but does not save any tags in the database: Enter image details here

The problem is here

When I'm trying to render the tag back in the edit view, Looks like:

Enter image details here

any Also appreciate the help!

See what custom view / edit templates are for your "tag" property:


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -