js中
function
Search()
{
var
businessDate = GetSelectedBusinessDate(
"#businessYear"
,
"#businessMonth"
);
var
ul=
' @Url.Action("Query", "FileImport", new { BusinessDate = businessDate })'
$(
'#dg'
).datagrid({ url: url });
}
businessDate 的值需要从GetSelectedBusinessDate得来的,但上面的代码,好像执行不了,提示:
当前上下文中不存在名称“businessDate”
当前上下文中不存在名称“businessDate”
解决方案
function Search()
{
var businessDate = GetSelectedBusinessDate("#businessYear", "#businessMonth");
var url =' @Url.Action("Query", "FileImport")'+“?BusinessDate=”+businessDate ;
$('#dg').datagrid({ url: url });
}
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>
假设你的url为
ABC/efg?AA=bb&cc=dd&&eefff=aaa"
你可以这样写
Url.Action("eft","ABC") + ?AA=bb&cc=dd&&eefff=aaa"
如果你一定要用官方的
可以这样写
ABC/efg?AA=bb&cc=dd&&eefff=aaa"
你可以这样写
Url.Action("eft","ABC") + ?AA=bb&cc=dd&&eefff=aaa"
如果你一定要用官方的
可以这样写
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));
取不到参数