【发布时间】:2013-07-19 14:03:54
【问题描述】:
我正在尝试从后面的 ASP.NET 代码调用一个 jQuery 函数。
我不希望它被 jQuery click 事件触发;我想在我的控件后面的代码中触发jQuery函数--->“显示对话框”。
$(document).ready(function () {
$("#LinkButton1").click(function(){
$("#hightlight_show1").toggle();
});
var dialog1 = $("#Add").dialog({
autoOpen: false,
width: 620,
height: 400
});
// Move the dialog back into the <form> element
dialog1.parent().appendTo(jQuery("form:first"));
$("#BT_add").click(function () {
$("#Add").dialog("open");
return false;
});
我尝试过类似的方法,但没有成功:
$(document).ready(function () {
$("#LinkButton1").click(function () {
$("#hightlight_show1").toggle();
});
var dialog1 = $("#Add").dialog({
autoOpen: false,
width: 620,
height: 400
});
// Move the dialog back into the <form> element
dialog1.parent().appendTo(jQuery("form:first"));
function a() {
$("#Add").dialog("open");
return false;
};
});
我在后面的代码中使用 Page.ClientScript.RegisterStartupScript() 指定了这一点:
Page.ClientScript.RegisterStartupScript(
this.GetType(),
"a",
"a();",
true
);
【问题讨论】:
标签: c# javascript jquery asp.net