【发布时间】:2017-09-20 01:37:24
【问题描述】:
我尝试让 JavaScript 在 ASP.NET 中工作 我的 JavaScript:
function reportOrder(sender, args) {
alert("Message");
window.location.href = @Url.Action("StartReport", "PrintOut", New With {.Area = "Printing", Key .ReportName = "Test",
Key .typeOfReport = TypeOfPrintingIS.Order,
Key .CompanyId = DirectCast(ViewData("CompanyId"), Guid),
Key .ExchangePrintData = CType(locOrderReport, ExchangeData.IExchangePrintData)});
}
首先,该功能有效,当我禁用 window.location 时,会引发警报!所以,问题必须在@UrlAction(
此外,Area 正在工作,因为当我使用类似的 Html.RenderAction 函数和另一个函数的另一个指令时,它工作正常。
Controller 内的功能:
<HttpPost>
Function StartReport(ReportName As String, typeOfReport As TypeOfPrintingIS, CompanyId As Guid, ExchangePrintData As Code.ExchangeData.IExchangePrintData) As ActionResult
Dim model As New HTML5ViewerModel()
model.ViewerOptions.UseUIMiniStyle = True
locReportHelper.CompanyId = CompanyId
locReportHelper.ReportName = ReportName
locReportHelper.TypeOfReport = typeOfReport
locReportHelper.ExchangePrintData = ExchangePrintData
model.ReportName = locReportHelper.CreateReportId
Return View("Html5Viewer", model)
End Function
而“IExchangePrintData”接口是一个空接口,用于验证类是否正确。
你们中有人有想法吗? 非常感谢 - 周末愉快
【问题讨论】:
-
使用
@Url.Action时浏览器控制台中是否有任何错误?
标签: javascript c# asp.net vb.net