当用户点击按钮Button1_Click
时,如何致电Button1
?
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "id", "show(showdivslowly)", true);
}
<!-- language: lang-html -->
<div id="showdivslowly" runat="server" style="width: 500px; height: 200px; background-color: Blue; display: none">Welcome</div>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
答案 0 :(得分:0)
尝试,
protected void Button1_Click(object sender, EventArgs e)
{
string script = "show(showdivslowly);";
ClientScript.RegisterClientScriptBlock(this.GetType(), "Show", script, true);
}
使用RegisterClientScriptBlock而不是RegisterStartupScript方法。