[AJAX] UpdatePanel et scroll listbox
Bonjour,
J'utilise un listbox pour lister des catégories(lstCategorie). Au load de la page la liste se rempli une première fois. Par la suite, si je clique sur un élément complètement en bas de la liste à droite(voir image en pièce jointe), je veux que le scroll demeure en bas. Je ne veux pas que le scroll remonte à chaque fois. Voici mon code aspx. Voir les sections en rouge et en gros caractère ici-bas.
Dans la section Page, j'ai ajouté l'attribut:maintainScrollPositionOnPostBack="true"
J'utilise un updatePanel. Je me suis créer un Trigger qui s'activera sur l'événement SelectedIndexChanged.
Voici comment j'ai défini mon listbox:
Code:
1 2 3 4 5
| <asp:ListBox CssClass="lstCategorie" ID="lstCategorie" runat="server" AutoPostBack="True"
SelectionMode="Multiple" OnSelectedIndexChanged="lstCategorie_SelectedIndexChanged">
</asp:ListBox> |
Voilà, lorsque je lance l'application, ca ne fonctionne pas...
Merci de m'aider!!
CODE ASPX:
Code:
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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
| <%@ Page Language="VB" maintainScrollPositionOnPostBack="true" MasterPageFile="~/Pub/Site.master" AutoEventWireup="false"
CodeFile="GererCategorie.aspx.vb" Inherits="Int_Pilotage_GererCategorie" Title="Untitled Page" %>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="sec2">
<div id="sec3">
<div id="sec4">
<%-- Liste des points d'inspection --%>
<div class="divlstPointInsp">
<asp:ListBox CssClass="lstPointInsp" ID="lstPointInsp" runat="server" AutoPostBack="true"
SelectionMode="Multiple"></asp:ListBox>
</div>
<%-- Boutons pour deplacer points d'inspection vers categories et vice-versa --%>
<div class="divFleche">
<mapaq:SecurizedImageButton CssClass="flecheDG" runat="server" ID="flecheDroite"
ImageUrl="<%$ Resources:GererCategorie, flecheDroite.Url %>" AlternateText="<%$ Resources:GererCategorie, flecheDroite.Alt %>"
Enabled="False"></mapaq:SecurizedImageButton>
<br />
<mapaq:SecurizedImageButton CssClass="flecheDG" runat="server" ID="flecheGauche"
ImageUrl="<%$ Resources:GererCategorie, flecheGauche.Url %>" AlternateText="<%$ Resources:GererCategorie, flecheGauche.Alt %>"
Enabled="False"></mapaq:SecurizedImageButton>
<br />
<mapaq:SecurizedImageButton CssClass="btnNP" runat="server" ID="btnNextTabOn" ImageUrl="<%$ Resources:GererCategorie, btnNextTabOn.Url %>"
AlternateText="<%$ Resources:GererCategorie, btnNextTabOn.Alt %>"></mapaq:SecurizedImageButton>
<br />
<mapaq:SecurizedImageButton CssClass="btnNP" runat="server" ID="btnPrevTabOn" ImageUrl="<%$ Resources:GererCategorie, btnPrevTabOn.Url %>"
AlternateText="<%$ Resources:GererCategorie, btnPrevTabOn.Alt %>"></mapaq:SecurizedImageButton>
</div>
</div>
<%-- Liste des categories --%>
<div class="divlstCategorie">
<asp:ListBox CssClass="lstCategorie" ID="lstCategorie" runat="server" AutoPostBack="True"
SelectionMode="Multiple" OnSelectedIndexChanged="lstCategorie_SelectedIndexChanged">
</asp:ListBox>
</div>
</div>
<%-- Fleche monter et descendre --%>
<div class="divMoveUpDown">
<mapaq:SecurizedImageButton CssClass="MoveUpDown" runat="server" ID="MoveUp" ImageUrl="<%$ Resources:Images, Image.MoveUp.Url %>"
AlternateText="<%$ Resources:Images, Image.MoveUp.Alt %>" Enabled="False"></mapaq:SecurizedImageButton>
<br />
<mapaq:SecurizedImageButton CssClass="MoveUpDown" runat="server" ID="MoveDown" ImageUrl="<%$ Resources:Images, Image.MoveDown.Url %>"
AlternateText="<%$ Resources:Images, Image.MoveDown.Alt %>" Enabled="False"></mapaq:SecurizedImageButton>
</div>
</div>
<br />
<%-- Ajout ou modification d'une categorie --%>
<div id="sec5">
<div id="sec6">
<div class="divCodeCat">
<div class="divlblCodeCat">
<mapaq:SecurizedLabel ID="lblCodeCat" runat="server" Text="<%$ Resources:GererCategorie, lblCodeCat.Text %>"
AssociatedControlID="txtCodeCat" />
</div>
<div class="divtxtCodeCat">
<mapaq:SecurizedTextBox CssClass="txtCodeCat" ID="txtCodeCat" runat="server" TextMode="SingleLine"
MaxLength="4" Wrap="true" Rows="1" Enabled="False" ReadOnly="True">String.Empty</mapaq:SecurizedTextBox>
<asp:RegularExpressionValidator runat="server" ID="CodeCatValidator" CssClass="CodeCatValidator"
ControlToValidate="txtCodeCat" ValidationExpression="^\d{1,2}\.0$" />
</div>
</div>
<div class="divNomCat">
<div class="divlblNomCat">
<mapaq:SecurizedLabel ID="lblNomCat" runat="server" Text="<%$ Resources:GererCategorie, lblNomCat.Text %>"
AssociatedControlID="txtNomCat" />
</div>
<div class="divtxtNomCat">
<mapaq:SecurizedTextBox CssClass="txtNomCat" ID="txtNomCat" runat="server" TextMode="SingleLine"
MaxLength="100" Wrap="true" Rows="1" Enabled="False" ReadOnly="True">String.Empty</mapaq:SecurizedTextBox>
</div>
</div>
<div class="divIndActiv">
<div class="divlblIndActiv">
<mapaq:SecurizedLabel ID="lblIndActiv" runat="server" Text="<%$ Resources:GererCategorie, lblIndActiv.Text %>"
AssociatedControlID="cboIndActiv" />
</div>
<div class="divcboIndActiv">
<mapaq:SecurizedDropDownList runat="server" Inherits="true" ID="cboIndActiv" Enabled="False">
</mapaq:SecurizedDropDownList>
<mapaq:SecurizedLinkButton runat="server" Inherits="true" ID="btnAdd" Text="<%$ Resources:GlobalSite, Site.Add.Button %>"
CssClass="linkbutton" />
</div>
</div>
</div>
<%-- Combinaison critique majeur --%>
<div class="divlblCcm">
<mapaq:SecurizedLabel CssClass="lblCcm" ID="lblCcm" runat="server" Text="<%$ Resources:GererCategorie, lblCcm.Text %>"
AssociatedControlID="cboCcm" />
<mapaq:SecurizedDropDownList CssClass="cboCcm" runat="server" Inherits="true" ID="cboCcm"
AutoPostBack="True" Enabled="False">
</mapaq:SecurizedDropDownList>
</div>
</div>
<%-- Boutons enregistrer et canceller --%>
<div class="divbtns">
<mapaq:SecurizedLinkButton runat="server" ValidationGroup="Group1" Inherits="true"
ID="btnSave" Text="<%$ Resources:GlobalSite, Site.Save.Button %>" CssClass="linkbutton"
Enabled="False" />
<mapaq:SecurizedLinkButton runat="server" Inherits="true" ID="btnCancel" Text="<%$ Resources:GlobalSite, Site.Cancel.Button %>"
CssClass="linkbutton" OnClick="btnCancel_Click" OnClientClick="return ConfirmerAnnuler(this);"
Enabled="False" />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lstCategorie" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel> |
</asp:Content>