Bonjour,

sur une de mes pages ASP MVC j'ai un menu que je fait flotter à droite. Ce menu me permet d'ajouter des contrôles dynamiquement à ma page/vue. Je ne comprend pas pourquoi lors de l'apparation du nouveau controle le menu de droite descend
tandis que le menu de gauche reste au bon endroit ?

Voici le css que j'ai :
Code css : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.menu-2 {
    /*display: inline-block;*/
    position: relative;
    float: left;
    width: 33%;
    /*right:380px;*/
}
 
#MesureExistante::-webkit-scrollbar {
    width: 5em;
}
 
#MesureExistante {    
    position:relative;
    float: right;
    width: 30%;
    margin-right:-31%;
    margin-top: -22.3%;
    margin-bottom:1%;
     max-height:800px;
     height: 100%;
     overflow:auto;
}

Et voici ma vue :

Code ASP : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
 
@ModelType RGPD_MVC.MesureTraitement
@Code
    ViewData("Title") = "Create"
    Dim nbMesure As Integer = 0
End Code
 
@Using (Html.BeginForm())
    @Html.AntiForgeryToken()
 
    @<div class="menu-2" style="margin-left:-33%;">
        <input type="text" value="@Session("TrtNom").ToString" name="NomTrt" class="nomTrt text-box single-line" />
        <hr class="hrMnu" />
        <div class="MnuContexte">CONTEXTE</div>
        <hr class="hrMnu" />
 
        @* TODO : appel à l'action edit à la place du create *@
        @Html.ActionLink("- principe fondamentaux", "create", "traitement", New With {.id = ViewContext.RouteData.Values("id")}, htmlAttributes:=New With {.class = "mnuCreaPrcpFond"})
 
        <div class="mnuRisque">RISQUES</div>
        <hr class="hrMnu" />
 
        <input type="submit" name="MsrPrevue" value="- Mesure existante ou prévue" class="linkButton mnuCreaRisque-current" />
        <input type="submit" id="AccIll" name="AccIll" value="- Accès illégitime à des données" class="linkButton mnuCreaRisque" />
        <input type="submit" id="ModNonDesire" name="ModNonDesi" value="- Modifications non désirées de données" class="linkButton mnuCreaRisque" />
        <input type="submit" id="DispDonn" name="DispDonn" value="- Disparition de données" class="linkButton mnuCreaRisque" />
 
        <hr class="hrMnu" />
 
        @Html.ActionLink("Annuler", "Index", "Traitement", "", htmlAttributes:=New With {.class = "btn btnMenu "})
        <input type="submit" value="Suivant" class="btn btnMenu" />
    </div>
 
    @<div class="form-horizontal" style="height:100%;">
 
        <div class="TitreIntituleCreaTrt" style="border: 1px solid grey; text-align: center; margin-top: 1%; margin-bottom: 10px; padding-top: 10px; padding-bottom: 10px;">
            <span style="color: #FD4664; font-weight: bold;">Risques</span><br />
            <span style="font-size:11px;">
                Cette section vous permet d'apprécier les risques sur la vie privée, <br />
                compte tenu des mesures existantes ou prévues.
            </span><br />
            <span style="color: #FD4664; ">Mesure existante ou prévue</span><br />
            <span style="font-size:11px;">
                Cette partie vous permet de recenser les mesures <br />
                (existantes ou prévues) contribuant à la sécurité des données.
            </span>
        </div>
        <div style="text-align: center; margin-bottom: 1%;">
            <input class="MainBouton" type="submit" value="+ Créer une mesure (ou en ajouter une proposée dans la base de connaissance)" />
            @*<asp:Button ID="btAjMesure" class="MainBouton" Style="width:100%; border: 2px solid #7eebb8; font-weight:bold;" Text="+ Créer une mesure (ou en ajouter une proposée dans la base de connaissance)"/>*@
        </div>
 
        <div class="trtMsr">
            @*@Html.ValidationSummary(True, "", New With {.class = "text-danger"})
            <div class="form-group">
                @Html.LabelFor(Function(model) model.Titre, htmlAttributes:=New With {.class = "control-label col-md-2"})
                <div class="col-md-10">
                    @Html.EditorFor(Function(model) model.Titre, New With {.htmlAttributes = New With {.class = "form-control"}})
                    @Html.ValidationMessageFor(Function(model) model.Titre, "", New With {.class = "text-danger"})
                </div>
            </div>*@
            <div id="divCont">
            </div>
        </div>
 
        @*<div class="trtMsr">
                @Html.ValidationSummary(True, "", New With {.class = "text-danger"})
                <div class="form-group">
                    @Html.LabelFor(Function(model) model.Titre, htmlAttributes:=New With {.class = "control-label col-md-2"})
                    <div class="col-md-10">
                        @Html.EditorFor(Function(model) model.Titre, New With {.htmlAttributes = New With {.class = "form-control"}})
                        @Html.ValidationMessageFor(Function(model) model.Titre, "", New With {.class = "text-danger"})
                    </div>
                </div>
 
                <div class="form-group">
                    @Html.LabelFor(Function(model) model.Explication, htmlAttributes:=New With {.class = "control-label col-md-2"})
                    <div class="col-md-10">
                        @Html.EditorFor(Function(model) model.Explication, New With {.htmlAttributes = New With {.class = "form-control"}})
                        @Html.ValidationMessageFor(Function(model) model.Explication, "", New With {.class = "text-danger"})
                    </div>
                </div>
 
                <div class="form-group">
                    @Html.LabelFor(Function(model) model.Commentaire, htmlAttributes:=New With {.class = "control-label col-md-2"})
                    <div class="col-md-10">
                        @Html.EditorFor(Function(model) model.Commentaire, New With {.htmlAttributes = New With {.class = "form-control"}})
                        @Html.ValidationMessageFor(Function(model) model.Commentaire, "", New With {.class = "text-danger"})
                    </div>
                </div>
 
                <div class="form-group">
                    @Html.LabelFor(Function(model) model.IdTraitement, htmlAttributes:=New With {.class = "control-label col-md-2"})
                    <div class="col-md-10">
                        @Html.EditorFor(Function(model) model.IdTraitement, New With {.htmlAttributes = New With {.class = "form-control"}})
                        @Html.ValidationMessageFor(Function(model) model.IdTraitement, "", New With {.class = "text-danger"})
                    </div>
                </div>
            </div>*@
    </div>
 
    @<div id="MesureExistante">
    @code
        Dim listeMesure As List(Of Mesure) = CType(ViewBag.Mesure, List(Of Mesure))
 
        For Each item As Mesure In listeMesure
            nbMesure += 1
    @<div style="margin-top:1.5%;">
        <span style="color:red;">@item.Type</span> &nbsp;
        <div style="display:inline-block;float:right;">
            <a href="#" class="linkAjMsr" onclick="AddTextBox();" title="Ajouter cette mesure">Ajouter</a>
            @*@Html.ActionLink("Ajouter", "Create", New With {.id = ViewContext.RouteData.Values("id")}, htmlAttributes:=New With {.class = "linkAjMsr", .onclick = "AddTextBox()", .title = "Ajouter cette mesure"})*@
        </div>
 
        <br />
        <span id="@nbMesure" class="titreMsr" onclick="ShowHide(@nbMesure)">&or; @item.Titre</span>
        <div id="description_@nbMesure" class="description">
            @item.Description
        </div>
    </div>
    Next
    End Code
</div>
End Using
<script src="~/Scripts/jquery-3.3.1.min.js"></script>
@*Jquery UI DOIT venir après Jquery et avant bootstrap*@
<script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
<script>
    //$('#MesureExistante').css('overflow', 'hidden')
 
    $(".description").hide();
 
    function ShowHide(id) {
        if ($("#description_" + id).is(":visible")) {
            $("#description_" + id).hide();
        }
        else {
            $("#description_" + id).show();
        }
    }
 
    function GetDynamicTextbox(value) {
        @*<div class="trtMsr">
            @Html.ValidationSummary(True, "", New With {.class = "text-danger"})
            <div class="form-group">
            @Html.LabelFor(Function(model) model.Titre, htmlAttributes:=New With {.class = "control-label col-md-2"})
            <div class="col-md-10">
                @Html.EditorFor(Function(model) model.Titre, New With {.htmlAttributes = New With {.class = "form-control"}})
                @Html.ValidationMessageFor(Function(model) model.Titre, "", New With {.class = "text-danger"})
            </div>
        </div>*@
        return '<div class="form-group">cxcvxcvxcvxv</div>';
    }
 
    function AddTextBox() {
        var div = document.createElement('DIV');
        div.innerHTML = GetDynamicTextbox("");
        document.getElementById("divCont").appendChild(div);
    }
 
    function RemoveTextBox(div) {
        document.getElementById("divCont").removeChild(div.parentNode.parentNode);
    }
</script>