好的,所以我想弄清楚如何根据这篇文章的建议使用控制器为我的页面正确调用模态弹出窗口
并且有点使用这个:
我有一个有下拉列表的视图,如果用户找不到他/她正在寻找的项目/值,他可以建议一个值(建议新值链接),该值应该调用控制器并返回一个弹出页面有几个领域.
这是视图上的对象:
<script type="text/javascript">
loadpopup = function ()
{
window.showModalDialog(‘/NewValue/New? , "loadPopUp", ‘width=100,height=100?);
}
</script>
<%: Html.DropDownList(model => model.ValueId, new selectlist........... %>
<%: Html.ActionLink("Suggest Value", "New", "NewValue", null, new { onclick = 'loadpopup()') %>
Run Code Online (Sandbox Code Playgroud)
我打算用来返回页面的控制器:
public class NewValueController : Controller{
public Actionresult New(){
return View();
}
}
Run Code Online (Sandbox Code Playgroud)
现在我被卡住了.我想返回一个页面,我可以格式化它,我必须返回一个字符串吗?我不能返回一个aspx(我使用),因为格式化会更容易吗?
关于我应该去哪个方向的任何建议都非常感谢.
谢谢!
我正在使用asp.net mvc3和jquery对话框在主视图中打开局部视图
这是我的结构..
部分观点1
<input type="button" onclick="function1();">
Run Code Online (Sandbox Code Playgroud)
局部视图2
<form method="post">
//some elements
@Html.RenderPartial("partialview1");
</form>
Run Code Online (Sandbox Code Playgroud)
观点1
<script src="myscript.js" />
<script src="jquery.js"/>
//some element
<div>
load partialview 2 as jquery dialogue
</div>
Run Code Online (Sandbox Code Playgroud)
myscript.js
function function1()
{
//some code
}
Run Code Online (Sandbox Code Playgroud)
这只是我的应用程序的概述
现在在上面的结构,如果我点击partialview1中的按钮我收到此错误:Microsoft JScript运行时错误:找不到成员.
我正在使用jquery对话框小部件来显示模式框.但是当按下F5时,模态打开时不会发生刷新.任何的想法?
有趣的更新:
试试这个演示:http://jqueryui.com/demos/dialog/#modal-message 现在当焦点在"ok"按钮上,然后刷新(F5)工作,但是当按钮没有焦点时,然后它没有.
更新2
实际上我们可以在对话框中添加任何类型的控件,将高度和宽度设置为0 css并设置焦点以使刷新工作.这不是最好的解决方案.我仍在尝试让按键工作.
更新3
以下似乎现在有效:
$(document).keydown(function(e)
{
if (e.which == 116) // key code of the F5 button
{
document.location.reload();
}
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个模式对话框来显示内容(某种或其他类型的html):
<script>
$.fx.speeds._default = 1000;
$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
closeOnEscape: true,
modal: true,
position: 'center',
width: 800,
height: 600,
show: "blind",
hide: "explode"
});
$( "#opener" ).click(function() {
$( "#dialog" ).dialog( "open" );
return false;
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
当我查看页面时,对话框是内联的而不是隐藏的.这是我的HTML:
<div id="dialog">This is my dialog that should be hidden until called</div>
<button id="opener">I Open the Dialog</button>
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我正在使用jQuery UI Dialog 来显示视频.视频工作正常.
我想要做的是最小化Dialog元素,就像在操作系统或类似的东西.像(" - ")这样的小图标可以最小化我的对话框,当我按(*)它会关闭对话框但保持视频在后台运行.
这是我的代码
//Watch Video
$(".watchVideo").live('click',function(){
if($('div.ui-dialog').length){
$('div.ui-dialog').remove();
}
var path = $(this).attr('rel');
var title = $(this).attr('title');
var $dialog = $('<div>', {
title: translator['Watch Video']
}).dialog({
autoOpen: false,
modal: true,
width: 600,
height: 500
});
var tab = '<table style="margin: 10px 10%;"><tr><td><object id="MediaPlayer1" width="500" height="400" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject" align="middle"><param name="'+title+'" value="'+path+'"> <param name="ShowStatusBar" value="True"> <param name="DefaultFrame" value="mainFrame"> <param name="autostart" value="false"> <embed type="application/x-mplayer2" pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" src="'+path+'" autostart="false" align="middle" …Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery打开一个对话框窗口,其中textarea转换为CKEditor的实例.我使用的是由CKEditor的团队提供的jQuery的适配器,但是当对话窗口打开了,我不能与编辑器进行交互(它的创建,但"空"是写在内容空间,我可以不点击任何东西,或修改内容).
这个错误报告似乎说通过使用补丁提供问题是固定的,但它似乎并没有为我工作...
这是我的代码(也许我以编程方式做错了):
HTML:
<div id="ad_div" title="Analyse documentaire">
<textarea id="ad_content" name="ad_content"></textarea>
</div>
Run Code Online (Sandbox Code Playgroud)
我的包括(所有内容都包含正确,但也许包括订单问题?):
<script type="text/javascript" src="includes/ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="includes/jquery/css/custom-theme/jquery-ui-1.7.2.custom.css" />
<script type="text/javascript" src="includes/jquery/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="includes/jquery/js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="includes/jquery/plugins/dialog-patch.js"></script>
<script type="text/javascript" src="includes/ckeditor/adapters/jquery.js"></script>
Run Code Online (Sandbox Code Playgroud)
使用Javascript:
$('#ad_content').ckeditor();
/* snip */
$('#ad_div').dialog(
{
modal: true,
resizable: false,
draggable: false,
position: ['center','center'],
width: 600,
height: 500,
hide: 'slide',
show: 'slide',
closeOnEscape: true,
autoOpen: false
});
$('.analyse_cell').click(function(){
$('#ad_div').dialog('open');
});
Run Code Online (Sandbox Code Playgroud)
编辑:经过一些进一步的测试后,我注意到按下工具栏按钮给了我这个错误:
错误:this.document.getWindow().$未定义源文件:includes/ckeditor/ckeditor.js行:82
我的应用程序中有大量的jquery-ui对话框.每次我需要一个新的,我写下以下几行:
$('.another-dialog').dialog({
title: 'Another dialog',
autoOpen: false,
draggable: true,
modal: true,
show: 'fade',
hide: 'fade',
width: 400,
position: ['center', 'center'],
buttons: [
{ text: 'Ok' },
{ text: 'Cancel' }
],
open: function(event, ui) { $(".ui-dialog-titlebar-close span").html('×') }
});
Run Code Online (Sandbox Code Playgroud)
一个对话框与另一个对话框之间唯一真正不同的是buttons和title键.我想在这里有一个JQuery对话框的应用程序范围设置,所以我只会打电话
$('.another-dialog').dialog({
title: 'Another dialog',
buttons: [
{ text: 'Ok' },
{ text: 'Cancel' }
]
});
Run Code Online (Sandbox Code Playgroud)
隐藏设置所有需要的哈希键(我称之为"默认"设置).
我知道我可以.dialog()打电话,比方说,.myDialog()打电话到我自己设置的地方.但我想知道是否有一种真正,方便的方法.
提前致谢!
我的情景:
单击Dialog1中的特定元素时,将打开Dialog2.
当你按Escape关闭Dialog2时,按预期工作并关闭Dialog2.
Dialog1仍然存在,你会认为它可以通过再次击中Escape来关闭,但事实并非如此.您必须先单击对话框,然后单击Escape才能关闭它.
这是我尝试过的,但无济于事:
// Array to hold all of our open dialogs id's
var openDialogs = [];
// the open: method in my dialog
open: function() {
openDialogs[openDialogs.length] = $(this).attr("id");
}
// the close: method in my dialog
close: function() {
var index = $.inArray($(this).attr("id"), openDialogs),
$previousDialog = (index > 0) ? $("#" + openDialogs[index]) : undefined;
// remove the current dialog from the array via Jon Resig's remove() method
openDialogs.remove(index);
// set focus to previously opened dialog …Run Code Online (Sandbox Code Playgroud) 我正在使用.ascx用户控件,其中我填写员工数据和员工图片.在点击员工图片时,我想显示一个对话框,我想要一个文本字段和一个文本框供用户输入.Click事件正常,但是通过对话框,它给出了"Microsoft JScript运行时错误:对象不支持属性或方法'对话框'"的错误.请任何人帮我填写一个带有文本字段和文本框的对话框.我是JQUERY的新手,并努力让它发挥作用.
在下面的代码片段中,我添加了一个在线查找的示例中的对话框代码.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="OpenAccessDataProvider,a4a794260c0b4440b466f75d11146db8.ascx.cs" Inherits="SitefinityWebApp.SfCtrlPresentation.OpenAccessDataProvider_a4a794260c0b4440b466f75d11146db8" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Comments" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Fields" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<telerik:RadListView ID="dynamicContentListView" ItemPlaceholderID="ItemsContainer" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
<LayoutTemplate>
<ul class="sfitemsList sfitemsListTitleDateTmb">
<asp:PlaceHolder ID="ItemsContainer" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<li class="sfitem sfClearfix">
<h2 class="sfitemTitle">
<sf:DetailsViewHyperLink ID="DetailsViewHyperLink" TextDataField="Title" runat="server" />
</h2>
<sf:AssetsField ID="AssetsField1" runat="server" DataFieldName="Picture" />
<sf:SitefinityLabel …Run Code Online (Sandbox Code Playgroud) jquery ×10
jquery-dialog ×10
jquery-ui ×5
asp.net-mvc ×2
javascript ×2
ckeditor ×1
modal-dialog ×1