我正在尝试使用函数在我的视图中返回路由值:
看法:
@functions {
public Dictionary<string, object> GetFilters()
{
var filters = new Dictionary<string, object>();
var f_phrase = this.Request["f_phrase"] ?? string.Empty;
var f_site = this.Request["f_site"] ?? string.Empty;
var f_device = this.Request["f_device"] ?? string.Empty;
var f_startdate = this.Request["f_startdate"] ?? string.Empty;
var f_enddate = this.Request["f_enddate"] ?? string.Empty;
var f_package = this.Request["f_package"] ?? string.Empty;
filters.Add("f_phrase", f_phrase);
filters.Add("f_site", f_site);
filters.Add("f_device", f_device);
filters.Add("f_startdate", f_startdate);
filters.Add("f_enddate", f_enddate);
filters.Add("f_package", f_package);
return filters;
}
}
然后在我的链接上我希望能够做到这一点:
@Html.ActionLink("Export file", "Export", "Log", new { @GetFilters() }, new { @class="iconDocumentText"})
但不起作用。