2014-05-05 42 views
0
  1. 如何隱藏文本框標題如何隱藏控件標題

    我希望能夠隱藏在我的網頁表單文本框的標題,我能夠隱藏文本框,但不是字幕。你能告訴我我錯過了什麼嗎?

    protected void Page_Load(object sender, EventArgs e) 
    { 
    if (cmdbox_TypePayment.SelectedIndex == 0) 
    { 
        txt_Carte.Visible = false; 
        txt_CarteNum.Visible = false; 
        txt_CarteDate.Visible = false; 
        txt_CarteCCV.Visible = false; 
    } 
    } 
    protected void cmdbox_TypePayment_SelectedIndexChanged(object sender, EventArgs e) 
    { 
    if (cmdbox_TypePayment.SelectedIndex == 0) 
    { 
        txt_Carte.Visible = false; 
        txt_CarteNum.Visible = false; 
        txt_CarteDate.Visible = false; 
        txt_CarteCCV.Visible = false; 
    } 
    
    else if (cmdbox_TypePayment.SelectedIndex == 1) 
    { 
        txt_Carte.Visible = true; 
        txt_CarteNum.Visible = true; 
        txt_CarteDate.Visible = true; 
        txt_CarteCCV.Visible = true; 
    } 
    } 
    
+0

不遵守你正在嘗試做的。你的意思是隱藏在文本框中的文本而不是文本框本身? –

+1

你是指隱藏標籤?如果是這樣,那麼你需要在標籤上設置可見屬性來隱藏它。聽起來就像你引用他們的「文本框」有一個標籤和文本框。 – Graymatter

+0

我想隱藏文本框的標籤 – user3499965

回答

0

設置一個ID的標籤也和它藏在同一function..Suppose labelhas的ID lblCaption ..

protected void cmdbox_TypePayment_SelectedIndexChanged(object sender, EventArgs e) 
{ 
    if (cmdbox_TypePayment.SelectedIndex == 0) 
    { 
     lblCaption.Visible = false; 
     txt_Carte.Visible = false; 
     txt_CarteNum.Visible = false; 
     txt_CarteDate.Visible = false; 
     txt_CarteCCV.Visible = false; 
    } 

    else if (cmdbox_TypePayment.SelectedIndex == 1) 
    { 
     lblCaption.Visible = true; 
     txt_Carte.Visible = true; 
     txt_CarteNum.Visible = true; 
     txt_CarteDate.Visible = true; 
     txt_CarteCCV.Visible = true; 
    } 
}