MVC:尝试显示绑定到控制器的用户控件,在 JQuery 对话框上没有结果
你好。 这是我的问题。 我有一个表单,需要显示一个表单(来自已完成的用户控件)。
这是代码:
<%@ Register src="~/Views/MyView.ascx" tagname="ViewToDisplay" tagprefix="uc1" %>
<script >
$.fx.speeds._default = 1000;
$(function() {
$("#dialog").dialog({
autoOpen: false,
show: "blind",
hide: "explode",
modal: true
});
$("#opener").click(function() {
$("#dialog").dialog("open");
return false;
});
});
</script>
(... code)
<div id="dialog">
<h3>Contain of my UC</h3>
<uc1:MyView ID="MyView1" runat="server" />
</div>
在对话框模式中打开我的 UC
但是当我单击按钮“opener”时,什么也没有发生。 即使我只是将“hello world”放入我的 UC 中(与当前页面位于同一文件夹中)。 但是,如果我删除“”行,则通常会显示模式弹出窗口。
知道吗,为什么我无法在 jQuery 对话框上显示 uc1?
编辑部分:
这部分代码不起作用(不显示对话框)
<html>
<%@ Register src="~/Views/MyView.ascx" tagname="ViewToDisplay" tagprefix="uc1" %>
<script >
$.fx.speeds._default = 1000;
$(function() {
$("#dialog").dialog({
autoOpen: false,
show: "blind",
hide: "explode",
modal: true
});
$("#opener").click(function() {
$("#dialog").dialog("open");
return false;
});
});
</script>
<div id="dialog">
<h3>Contain of my UC</h3>
<uc1:MyView ID="MyView1" runat="server" />
</div>
</html>
这部分代码正在工作:(我删除了对话框中包含的 uc1)
<html>
<%@ Register src="~/Views/MyView.ascx" tagname="ViewToDisplay" tagprefix="uc1" %>
<script >
$.fx.speeds._default = 1000;
$(function() {
$("#dialog").dialog({
autoOpen: false,
show: "blind",
hide: "explode",
modal: true
});
$("#opener").click(function() {
$("#dialog").dialog("open");
return false;
});
});
</script>
<div id="dialog">
<h3>Contain of my UC</h3>
Im the king of the world without my dialog box...
</div>
</html>
HI.
This my problem.
I have a form, which need to display a form (coming from a user control already done).
This is the code :
<%@ Register src="~/Views/MyView.ascx" tagname="ViewToDisplay" tagprefix="uc1" %>
<script >
$.fx.speeds._default = 1000;
$(function() {
$("#dialog").dialog({
autoOpen: false,
show: "blind",
hide: "explode",
modal: true
});
$("#opener").click(function() {
$("#dialog").dialog("open");
return false;
});
});
</script>
(... code)
<div id="dialog">
<h3>Contain of my UC</h3>
<uc1:MyView ID="MyView1" runat="server" />
</div>
Open my UC in my dialog modal
But when I click on my button "opener", nothing happened.
Even if I just put 'hello world' in my UC (which is in the same folder than the current Page).
However, if I remove the line "", the modal popup is normally displayed.
Any idea, why I cant display the uc1 on my jQuery Dialog box ??
Edited part :
This part of code is not working (no display of a dialog)
<html>
<%@ Register src="~/Views/MyView.ascx" tagname="ViewToDisplay" tagprefix="uc1" %>
<script >
$.fx.speeds._default = 1000;
$(function() {
$("#dialog").dialog({
autoOpen: false,
show: "blind",
hide: "explode",
modal: true
});
$("#opener").click(function() {
$("#dialog").dialog("open");
return false;
});
});
</script>
<div id="dialog">
<h3>Contain of my UC</h3>
<uc1:MyView ID="MyView1" runat="server" />
</div>
</html>
This part of code is working : (I removed the include of my uc1 in my dialog)
<html>
<%@ Register src="~/Views/MyView.ascx" tagname="ViewToDisplay" tagprefix="uc1" %>
<script >
$.fx.speeds._default = 1000;
$(function() {
$("#dialog").dialog({
autoOpen: false,
show: "blind",
hide: "explode",
modal: true
});
$("#opener").click(function() {
$("#dialog").dialog("open");
return false;
});
});
</script>
<div id="dialog">
<h3>Contain of my UC</h3>
Im the king of the world without my dialog box...
</div>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我终于找到了我的问题的解决方案:这只是一个重复 JQuery 声明代码的问题,存在于主窗体中,并在名为的 UserControl 中...
Well I finally find the solution to my problem : it was only a problem of redunding JQuery declaration code, present in the main form, and in the UserControl called...