[英]MvcReportViewer - posting multiple parameters
我有一個MVC項目,正在使用來自https://github.com/ilich/MvcReportViewer的MvcReportViewer。 當使用接受單個字符串的參數時,這可以很好地工作...
假設我們有一個SSRS報告,其中包含一個名為“ myArrayOfLocations”的多值類型的下拉列表,我想發布以下內容:
@Html.MvcReportViewerFluent(ViewData["ReportUrl"].ToString()).Method(
FormMethod.Post).ReportParameters(
new {ID=3, myArrayOfLocations="UK,France,Germany,Spain,USA"}).Attributes(new { Height = 900, Width = 900, style = "border: none", frameBorder = "0" })
上面的代碼“應該”然后將滴答聲放在下拉框中,但是沒有!
如果我只是設置myArrayOfLocations =“ UK”-綁定很好。
我究竟做錯了什么?
我應該提到的是,我將控件中的參數作為“列表>”對象傳遞給ViewData []。
基本上,您必須遍歷所有值並將它們作為鍵值對一一添加。
例如:
reportParams.Insert(reportParams.Count, new KeyValuePair<string, object>("myArrayOfLocations", "UK"));
reportParams.Insert(reportParams.Count, new KeyValuePair<string, object>("myArrayOfLocations", "France"));
對每個值重復..
希望能有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.