开发者

RoutingExpressionBuilder Dynamic Parameters

开发者 https://www.devze.com 2023-02-20 03:48 出处:网络
Using routing in web forms in ASP.NET 4.0. Looking to use dynamic parameters in the RoutingExpressionBuilder classsomething like:

Using routing in web forms in ASP.NET 4.0. Looking to use dynamic parameters in the RoutingExpressionBuilder class something like:

NavigateUrl="<%$ RouteUrl:searchterm={dynamicParameterFromObject} %>">

Would like to know the proper syntax is availa开发者_运维百科ble.

cheers


Hard to do with the <%$ syntax.

This alternative should work.

<%
    String routeName= "<<routeName>>";
    String controllerName= "<<controllerName>>";
    String actionName="<<action>>";

    String url=GetRouteUrl(routeName, new { Controller = controllerName, Action=actionName });
%>

...
NavigateUrl="<%=url%>"
0

精彩评论

暂无评论...
验证码 换一张
取 消