ASP .Net TextChanged 以显示 Jquery 对话框
当附有日期选择器的文本框上的文本发生更改时,我想在某些条件下显示 jquery 对话框。
在我的 TextChanged 事件中,我调用了一个 javascript 函数,该函数应该
protected void txtPickupDate_TextChanged(object sender, EventArgs e)
{
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "showInfo", "showDialog();", true);
}
在我的 aspx 页面上显示对话框 Javascript 是:
function showDialog() {
$("#popInfo").dialog("open");
}
使用 firebug 我看到 javascript 函数被触发,但对话框从未显示。我在页面上放置了一个asp按钮,调用函数onClientClick来测试该功能,它运行得很好。
我还尝试了其他地方提到的解决方案,但仍然没有运气:
$('#popInfo').parent().appendTo(jQuery("form:first"));
我很确定这与更新面板或回发有关,但它让我难住了。非常感谢任何帮助!
I want to display a jquery dialog under certain conditions when the text changes on a textbox which has a datepicker attached to it.
In my TextChanged event I call to a javascript function which should display the dialog
protected void txtPickupDate_TextChanged(object sender, EventArgs e)
{
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "showInfo", "showDialog();", true);
}
Javascript on my aspx page is:
function showDialog() {
$("#popInfo").dialog("open");
}
Using firebug I see that the javascript function is fired but the dialog is never displayed. I put an asp button on the page calling the function onClientClick to test the function and it works perfectly.
I also tried a solution mentioned else where but still no luck:
$('#popInfo').parent().appendTo(jQuery("form:first"));
I'm pretty sure that is has something to do with updatepanels or postbacks but it has me stumped. Greatly appreciate any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您已经配置了 TextChanged 事件,并且在调试它时您可以看到它在那里,请尝试使用 thisTextChanged 事件:
我假设您正在将 UpdatePanel 与 ScriptManager 一起使用。
另请参阅 AJAX 控制工具包 和 JQuery 自动完成插件,了解调用服务器端代码的其他方法。
If you have configured your TextChanged event and when you debug it you can see it going in there, try thisTextChanged event instead:
I am assuming you are using UpdatePanel with a ScriptManager.
Also look at AJAX Control Tool Kit and JQuery Autocomplete Plugin for other ways to call server side code.