Note that there are some explanatory texts on larger screens.

plurals
  1. POInsert Row from dropdown menu with data from other table
    primarykey
    data
    text
    <p>I have 2 tables What i try is in last div where is CategoryName to be a DrobDown list with Names that i've already insert...how to get this data? If something about code is not clear i will explain this is my Model:</p> <pre><code>public class Profits { [Key] public int id { get; set; } public double Value { get; set; } public string Description { get; set; } public DateTime DateCreation { get; set; } public ProfitCategories CategoryName { get; set; } } </code></pre> <p>}</p> <p>this is my controller:</p> <pre><code> public ActionResult DoInsertProf(Profits profits) { var Profit = new Profits { CategoryName = profits.CategoryName, Value = profits.Value, DateCreation = DateTime.Now, Description = profits.Description, }; db.Profit.Add(profits); db.SaveChanges(); return Redirect("/SelectData/ReadProfit"); } </code></pre> <p>and this is my view:</p> <pre><code>@using (Html.BeginForm("DoInsertProf","InsertProfit")) { @Html.ValidationSummary(true) &lt;fieldset&gt; &lt;legend&gt;Profits&lt;/legend&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.Value) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.Value) @Html.ValidationMessageFor(model =&gt; model.Value) &lt;/div&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.Description) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.Description) @Html.ValidationMessageFor(model =&gt; model.Description) &lt;/div&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.CategoryName) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.CategoryName) @Html.ValidationMessageFor(model =&gt; model.CategoryName) &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload