Asp.net 当其他字段可见时,HTML跳转到页面顶部

Asp.net 当其他字段可见时,HTML跳转到页面顶部,asp.net,Asp.net,我在我的页面中有一些cs,当选择一个项目符号时,会显示一个文本框,提供有关选择该项目符号的原因的信息。我遇到的问题是,当选中项目符号并显示文本框时,页面总是跳到顶部,用户必须向下滚动 这也会导致my fileupload字段在开始上载时文本消失,然后更改页面其余部分的项目符号 有人知道一种方法来阻止它跳转并保护fileupload字段不被重置数据吗 <p> <asp:Label ID="lblstoretooling" runat="server" Text="If no, w

我在我的页面中有一些cs,当选择一个项目符号时,会显示一个文本框,提供有关选择该项目符号的原因的信息。我遇到的问题是,当选中项目符号并显示文本框时,页面总是跳到顶部,用户必须向下滚动

这也会导致my fileupload字段在开始上载时文本消失,然后更改页面其余部分的项目符号

有人知道一种方法来阻止它跳转并保护fileupload字段不被重置数据吗

<p>
<asp:Label ID="lblstoretooling" runat="server" Text="If no, why?"></asp:Label>
<asp:TextBox ID="txtstoretooling" runat="server" height="50px" TextMode="MultiLine" Width="600px"></asp:TextBox>
</p>
<br>
<p>Did you delete program(s) from the "To Machine" folder?
<asp:RadioButtonList ID="isdeletedprogram" runat="server" AutoPostBack="True" OnSelectedIndexChanged="isdeletedprogram_SelectedIndexChanged" RepeatDirection="Horizontal" style="position: relative;">
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:RadioButtonList>
</p>

这很可能是由自动回发引起的:

<asp:RadioButtonList ID="isdeletedprogram" runat="server" 
                     AutoPostBack="True" OnSelectedIndexChanged="isdeletedprogram_SelectedIndexChanged"
                     RepeatDirection="Horizontal" style="position: relative;">
您的页面。加载将如下所示

protected void Page_Load()
{
    if(!Page.IsPostback)
    {
        //do anything you would normally do
    }
    else
    {
        //this will get executed on a Postback. Load data here
        LoadPageState()
    }
}

这取决于您在这里选择哪种持久性内存。会话、缓存、视图状态…

你是说CSS?请校对。您能否只共享客户端源代码,而不共享cs代码。。我猜它在某处生成了锚元素..你是说网络配置?对不起,我不是很流利的HTML。我知道的足够多了,所以我需要在页面的每一个部分都做这个操作,每个部分都有刷新页面的单选按钮?
//call this one in your isdeletedprogram_SelectedIndexChanged 
protected void SavePageState()
{
    Session["IsDeletedState"] = isdeletedprogram.SelectedIndex;
    /*...*/
}

//call this on in the else clause - when a postback occurs
protected void LoadPageState()
{
    isdeletedprogram_SelectedIndexChanged = Session["IsDeletedState"];
    /*add any server side controls state you want to save here*/
}
protected void Page_Load()
{
    if(!Page.IsPostback)
    {
        //do anything you would normally do
    }
    else
    {
        //this will get executed on a Postback. Load data here
        LoadPageState()
    }
}