JS调用后台方法
html:
<asp:Button ID="Button1" runat="server" Text="Button" style="display:none;" onclick="Button1_Click" />
<input id="Button2" type="button" onclick="document.getElementById('Button1').click();" value="button" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
后台:
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
<asp:Button ID="Button1" runat="server" Text="Button" style="display:none;" onclick="Button1_Click" />
<input id="Button2" type="button" onclick="document.getElementById('Button1').click();" value="button" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
后台:
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}