JS in
function
Search()
{
var
businessDate = GetSelectedBusinessDate(
"#businessYear"
,
"#businessMonth"
);
var
ul=
‘ @Url.Action("Query", "FileImport", new { BusinessDate = businessDate })‘
$(
‘#dg‘
).datagrid({ url: url });
}
The value of businessdate needs to be obtained from getselectedbusinessdate, but the above code does not seem to be executing, prompting:
The name "Businessdate" solution does not exist in the current context function Search () {
var businessdate = getselectedbusinessdate ("#businessYear", "#businessMonth");
var url = ' @Url. Action ("Query", "fileimport") ' + '?businessdate= "+businessdate;
$ (' #dg '). DataGrid ({Url:url});
} <iframe src= "@Html.raw(Url.action ("Edit", "Home", new {@Id=13,@Name= "Lizikang"}) "></iframe>, <iframe src=" @Html.raw(Url.action ("Edit", "Home", new {id=13,name= "Lizikang"})) "></iframe> Suppose your Url is
ABC/EFG? Aa=bb&cc=dd&&eefff=aaa "
You can write that.
Url.action ("EFT", "ABC") +? Aa=bb&cc=dd&&eefff=aaa "
If you must use the official
Can write like this
public
RouteValueDictionary ParseQueryStringToRouteValues(
string
queryString)
{
var parsed = HttpUtility.ParseQueryString(queryString);
Dictionary<
string
,
object
> querystringDic = parsed.AllKeys
.ToDictionary(k => k, k => (
object
)parsed[k]);
return
new
RouteValueDictionary(querystringDic);
}
var url = Url.Action(
"eft"
,
"ABC"
,ParseQueryStringToRouteValues(
"AA=bb&cc=dd&&eefff=aaa"
)) ;
用
new
{} 形式好像不行,
至少用
return
RedirectToAction(
"CouponGrant"
, ParseQueryStringToRouteValues(
"Couponid="
+ cg.CouponId));
取不到参数
@Url in Mvc4. Action How to read the value of a JavaScript variable