我想通过单击按钮来显示特定的 div
我的asp代码如下
<asp:Button ID="Button1" class="btn" runat="server" OnClick="Submit" />
<div runat="server" id="signup" Visible="false">Some Content </div>
现在在CodeBehind中我编写了以下代码
protected void Submit(object sender, EventArgs e)
{
Button1.Visible = false;
signup.Visible = true;
}
但是每次我收到错误时
the name signup does't exist in the current context
我无法找出代码中的问题..
最佳答案
您的 div
可能有错误的 html
,您也可以使用 style="visible:none"
而不是 Visible="false ”
更改
visible:"false"
至
Visible="false"
关于c# - 在asp.net中单击按钮时显示div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22641115/