2016-08-01 89 views

回答

0

您可以使用UpdatePanel和Scriptmanager。

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 

    <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
     <ContentTemplate> 
      <fieldset> 

       <asp:Label ID="Label1" runat="server" Text="Question 1"></asp:Label> 

       <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> 

      </fieldset> 
     </ContentTemplate> 
    </asp:UpdatePanel> 

而且在后面的代码只是做你总是这样

protected void Button1_Click(object sender, EventArgs e) 
{ 
    Label1.Text = "Question 2"; 
} 

你会发现,单击按钮时不需要刷新页面标签的文本改变。

相关问题