아래에 작성된 코드는 특정 조건에 대한 텍스트 상자를 표시합니다. 그러나 다른 관련없는 버튼이나 링크를 클릭하면 다른 활동을 수행 할 때 표시되도록 유지해야합니다. 웹 페이지다른 버튼 또는 링크 버튼을 클릭하면 동적 텍스트 상자가 사라짐
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox new_textbox = new TextBox();
if (DropDownList1.Text.Equals("OFF"))
{
new_textbox.ID = "txt" + 1;
PlaceHolder1.Controls.Add(new_textbox);
Label5.Visible = true;
new_textbox.Visible = true;
}
else
{
Label5.Visible = false;
}
}