继续回传页面位置 [英] Keep page position on postback

查看:122
本文介绍了继续回传页面位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们正在研究这个项目的学校,有一个问题

Hi guys are working on this project for school and have a problem


        

    <asp:LinkButton ID="LinkEdit" runat="server" CssClass="right_bottom" 
        onclick="LinkEdit_Click" Height="16px">edit</asp:LinkButton>
    <asp:LinkButton ID="Linkhide" runat="server" CssClass="right_bottom" 
        onclick="Linkhide_Click" Visible="False" hide</asp:LinkButton>
    <br />
    <hr style="width: 740px; height: -6px; margin-left: 0px; " />
    <asp:Label ID="labelFullname" runat="server" Text="Full Name" CssClass="left_top"></asp:Label>
    <asp:Label ID="labelNameDisplay" runat="server" Text="Put name here" CssClass="right_top"></asp:Label>

    <br />
    <asp:Panel ID="panelName" runat="server" Height="240px" Visible="False" CssClass="panel_top"
        style="text-align: left;">

        <asp:Label ID="Label8" runat="server" CssClass="left" Text="Please allow 24 hours for name changes to take effect."></asp:Label>
    <div align="center"><br />
    <br />
    <table>
       <tr>
       <td class="label_new">
         <asp:Label ID="Label4" runat="server" Text="Full Name:" ToolTip="Name Displayed"></asp:Label>
         </td>
         <td align="left">

          <asp:DropDownList ID="DropDownList1"  runat="server" BorderStyle="Groove" 
                 Font-Names="Segoe UI,Tahoma,Verdana,Arial,Times" Font-Size="100%" Height="25px" 
          valign="middle" Width="250px">
              <asp:ListItem></asp:ListItem>
              <asp:ListItem></asp:ListItem>
              <asp:ListItem></asp:ListItem>
          </asp:DropDownList>
       </td>
  </tr>


   <tr>
       <td class="label_new">
         <asp:Label ID="Label2" runat="server" Text="First Name:"></asp:Label>
         </td>
         <td align="left">
         <asp:TextBox ID="txtFirstName" runat="server" BorderStyle="Groove" Font-Names="Segoe UI,Tahoma,Verdana,Arial,Times" Font-Size="100%" Height="20px" 
          valign="middle" Width="242px"></asp:TextBox>
       </td>
  </tr>

     <tr>
       <td class="label_new">
         <asp:Label ID="Label9" runat="server" Text="Middle Name:"></asp:Label>
         </td>
         <td align="left">
         <asp:TextBox ID="txtMiddleName" runat="server" BorderStyle="Groove" Font-Names="Segoe UI,Tahoma,Verdana,Arial,Times" Font-Size="100%" Height="20px" 
          valign="middle" Width="242px" onfocus="if (this.value == 'optional') {   this.value='';  this.style.color='black';}" />
       </td>
  </tr>

     <tr>
       <td class="label_new">
         <asp:Label ID="Label10" runat="server" Text="Last Name:"></asp:Label>
         </td>
         <td align="left">
         <asp:TextBox ID="txtLastName" runat="server" BorderStyle="Groove" Font-Names="Segoe UI,Tahoma,Verdana,Arial,Times" Font-Size="100%" Height="20px" 
          valign="middle" Width="242px"></asp:TextBox>
       </td>
  </tr>
  <tr>
  <td colspan="2">
      <asp:Button ID="btnSaveChanges" runat="server" Text="Save Changes" 
          onclick="btnSaveChanges_Click" />
  </td>
  </tr>
    </table>
    </div>

    </asp:Panel>

我有4个小组以这种形式就像在Facebook帐户设置。
我在这里的问题是,当我告诉它只是跳转到页面顶部的面板。

I have 4 panels in this format just like ACCOUNT SETTINGS on facebook. My problem here is when i show the panel it just jump to the top of the page.

会喜欢这样做只是为Facebook的方式是。点击并在ü点击在同一个位置上。

Will like to do it just as the way facebook is. click and be on at the same position of where u clicked.

感谢

推荐答案

您可以设置MaintainScrollPositionOnPostback属性页面上:

You can set the MaintainScrollPositionOnPostback property on your page:

Page.MaintainScrollPositionOnPostback = true;

,或把它放在网页声明

or put it in the page declaration

<%@ Page MaintainScrollPositionOnPostback="true" %> 

这篇关于继续回传页面位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆