Id喜歡顯示標籤(使可見一個隱藏),並單擊時更改一個按鈕的文本,並能夠再次單擊按鈕以顯示其原始文本並隱藏標籤。'ASP.NET C#如何隱藏/顯示文本當你點擊一個按鈕
public partial class TestClick : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
btnShowButtonText.Text = "Button";
lblShowText.Visible = false;
}
}
protected void btnShowButtonText_Click(object sender, EventArgs e)
{
if (!Session.IsNewSession)
{
btnShowButtonText.Text = "Hide gift voucher details";
lblShowText.Visible = true;
}
}
問題是?你有什麼嘗試? – MarioDS
回想起來,我認爲做這個服務器端是非常糟糕的。這應該是客戶端功能。 – MarioDS