我使用以下代码显示div按钮点击事件。有没有办法从后面的C#代码中调用此按钮单击事件。
$(document).on("click", '#AddNew', function (e) {
e.stopPropagation();
if ($NewEntry.is(":hidden")) {
$NewEntry.slideDown("slow", "easeOutBounce");
$NewEntry.slideDown("slow", "easeOutBounce");
$filter.slideUp("slow");
return false;
} else {
$NewEntry.slideUp("slow");
return false;
}
});
答案 0 :(得分:1)
使用此代码:
protected void myButton(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>myFunction(params...);</script>", false);
}