Javascript ASP.NET MVC应用程序中带有消息的弹出窗口
我在使用剑道用户界面的ASP.NETMVC应用程序(razor)中工作。当客户点击按钮时,我应该显示一份报告。但是,报告并没有这么快,我应该在客户端的弹出窗口中显示一条消息,类似这样:“正在生成报告-稍后将出现一个新窗口,显示结果”。如何显示带有消息的弹出窗口?代码在哪里?请看我使用的代码。按钮是:Javascript ASP.NET MVC应用程序中带有消息的弹出窗口,javascript,c#,asp.net,asp.net-mvc,Javascript,C#,Asp.net,Asp.net Mvc,我在使用剑道用户界面的ASP.NETMVC应用程序(razor)中工作。当客户点击按钮时,我应该显示一份报告。但是,报告并没有这么快,我应该在客户端的弹出窗口中显示一条消息,类似这样:“正在生成报告-稍后将出现一个新窗口,显示结果”。如何显示带有消息的弹出窗口?代码在哪里?请看我使用的代码。按钮是: <a class="k-button k-button-icontext k-grid-Patient" id="hrefAllCheckedPatientsRep" style="displ
<a class="k-button k-button-icontext k-grid-Patient" id="hrefAllCheckedPatientsRep" style="display:none;" href="#" onclick="getAllChecked();">Generate Report</a>
在控制器中,我有一个操作:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ExportToPDF(List<String> uniqueIds) {
// step 1: creation of a document-object
var document = new Document(PageSize.A4.Rotate(), 3, 3, 80, 50);
//Here is the code for export to pdf
// Add table to the document
document.Add(dataTable);
//This is important don't forget to close the document
document.Close();
byte[] byteInfo = output.ToArray();
output.Write(byteInfo, 0, byteInfo.Length);
output.Position = 0;
var fName = string.Format("File-{0}.pdf", DateTime.Now.ToString("s"));
Session[fName] = output;
return Json(new { success = true, fName }, JsonRequestBehavior.AllowGet);
}
使用此代码创建包含消息的div
<div id="effect" class="ui-widget-content ui-corner-all">
<p>Loading Files...</p>
</div>
在ajax中隐藏弹出窗口
success: function (data) {
if (data.success) {$( "#effect:visible" ).removeAttr( "style" ).fadeOut();}
希望这能有所帮助。建议:与其使用弹出窗口,不如使用加载的gif图像,这样可以轻松显示和隐藏。您可以使用简单的jQuery在GenerateReport按钮单击时显示图像,并将其隐藏在ajax成功中。
<div id="effect" class="ui-widget-content ui-corner-all">
<p>Loading Files...</p>
</div>
function getAllChecked() {$( "#effect" ).show( selectedEffect, options, 500, callback );}
success: function (data) {
if (data.success) {$( "#effect:visible" ).removeAttr( "style" ).fadeOut();}