vb.net - how to maintain DIV scroll bar position in Listview ASP.net -


my problem when click imagebutton ("imgedit") in listview scroll bar of listview doesnt stay in position click it.

heres code:

 <asp:updatepanel id="updatepanel1" updatemode="conditional" runat="server">  <contenttemplate>  <asp:scriptmanager id="scriptmanager1" runat="server">  </asp:scriptmanager>      <asp:listview id="lv_profile" runat="server" groupitemcount="1"  groupplaceholderid="groupplaceholder1"         itemplaceholderid="itemplaceholder1" onitemdatabound="lv_profile_itemdatabound" onselectedindexchanged="lv_profile_selectedindexchanged" >         <layouttemplate>           <div id ="mainprofile" style="overflow-x: scroll; margin: 0 65px;" runat="server">             <div id="subdivprof" runat="server" style="height: inherit; width: 3400px; margin: 10px 0;">                  <asp:placeholder runat="server" id="groupplaceholder1"></asp:placeholder>             </div>           </div>         </layouttemplate>         <grouptemplate>                 <asp:placeholder runat="server" id="itemplaceholder1"></asp:placeholder>         </grouptemplate>                <itemtemplate>             <div class="divprofile">                 <div id="proftools" class="tools" runat="server">                     <asp:imagebutton id="imgcancel" cssclass="img"                              imageurl="~/images/delete-52 (1).png" runat="server" alt=""                              tooltip="cancel edit" visible="false" onclick="doneedit" />                     <asp:imagebutton id="imgdone" cssclass="img"                              imageurl="~/images/checkmark-52.png" runat="server" alt=""                              tooltip="done edit" visible="false" />                     <asp:imagebutton id="imgedit" cssclass="img" imageurl="~/images/edit user male-52.png"                              runat="server" alt="" tooltip="edit profile" onclick = "edituser" />                     <asp:imagebutton id="imgemail" cssclass="img" imageurl="~/images/-message filled-52.png"                              runat="server" alt="" tooltip="send email" />                 </div>                 <div id="proginfo" runat="server">                     <div class="level"><%#eval("prog_pos")%></div>                     <div class="pic"><asp:imagebutton id="imagebutton1" cssclass="img"  runat="server" onclick="finduser" onclientclick="return choosefile();" tooltip='<%#eval("idno")%>' enabled="false" /></div>                     <div class="nickname"><asp:textbox id="txtnickname" runat="server" text='<%#eval("nickname") %>'  cssclass="txt" enabled="false" style="margin-top:10px;"></asp:textbox></div>                     <div class="name"><asp:textbox id="txtname" runat="server" text='<%#eval("name")%>' cssclass ="txt" enabled="false" ></asp:textbox></div>                     <div class="email"><asp:textbox id="txtemail" runat="server" text='<%#eval("emailaddress")%>' cssclass="txt" enabled="false"></asp:textbox></div>                 </div>             </div>         </itemtemplate>         </asp:listview>  </contenttemplate>     </asp:updatepanel> 

thanks in advance. :)

you need after update return list position.

add in .aspx

<asp:hiddenfield id="scrollposition" runat="server"/> 

next need in js

find hiddenfield

var hdfield = document.getelementbyid(<%=scrollposition.clientid%>); 

find list

var list= document.getelementbyid('lv_profile'); 

onscroll event set value hiddenfield

list.onscroll = function() {      hdfield .value = list.scrolltop; } 

when window or document onload return saved position

window.onload = function () {      list.scrolltop = hdfield.value; } 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -