Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ! I'm new in mvc .net and I have an issue I have a which list data from Table Operatrice and each row has a dropdownlist listing Operation from table Operation. what I want to do is when the user chooses any Operation ans click on the button The foreign key Id_Operatrice in the table Operation gets the value of Id_Operatrice (selected)

clearly this is what I want to do : insert into Operation.Id_Operatrice value = idOperatrice(item in ) where Operation.Designation = dropdownlist.selecteditem.value

I implemented the view but I have no idea haw to implement my controller

I'd be grateful if you help me

This is my view


C#
@model SomefMVC.Models.MultipleModels

          @{
      ViewBag.Title = "Affectation";}

      <h2>Affectation</h2>
       <body style="background-color: #F2F7B9">
<table style="width: 100%;">
    <tr>
        <th>@Html.DisplayName("Id_Operatrice")</th>
        <th>@Html.DisplayName("Nom_Operatrice")</th>
        <th>@Html.DisplayName("Prenom_Operatrice")</th>
        <th>@Html.DisplayName("Operation")</th>
    </tr>
    @foreach (var item in ViewBag.Operatrices)
    {
        <tr>
            <td id="idoperatrice">@item.Id_Operatrice</td>
            <td>@item.Nom_Operatrice</td>
            <td>@item.Prenom_Operatrice</td>
            <td id="designation">
                <select>
                    <option>Select Operation</option>
                    @foreach (var item1 in ViewBag.Operations)
                    {
                        <option>@item1.Designation</option>
                    }
                </select>
            </td>
        </tr>
    }
    </table>
    <p>
        <input type="submit" value="Affecter" />
    </p>
</body>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900