0 asp.net
我有一个web项目,在视图中包含两个按钮.当我单击一个按钮时,必须显示一些文本框和第二个按钮.在文本框中输入数据后,当我尝试单击第二个按钮时,它不起作用.我该怎么做才能让它发挥作用?提前致谢.
Pan*_*hra 11
拉胡尔试试这个
在aspx页面中
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />
Run Code Online (Sandbox Code Playgroud)
在aspx.cs页面中
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Button2.Visible = false;
TextBox1.Visible = false;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Button2.Visible = true;
TextBox1.Visible = true;
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "Testing";
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
103 次 |
| 最近记录: |