RouteUrlExpressionBuilder.GetRouteUrl(Control, String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建与路由 URL 格式的指定路由密钥对应的 URL。
public:
static System::String ^ GetRouteUrl(System::Web::UI::Control ^ control, System::String ^ expression);
public static string GetRouteUrl(System.Web.UI.Control control, string expression);
static member GetRouteUrl : System.Web.UI.Control * string -> string
Public Shared Function GetRouteUrl (control As Control, expression As String) As String
参数
- control
- Control
表达式绑定到的控件。
- expression
- String
标记中指定的表达式。
返回
对应于当前 Route 对象的路由 URL 格式的 URL。
例外
参数 control 为 null.
该方法无法分析标记中指定的表达式。 有关详细信息,请参阅 TryParseRouteExpression(String, RouteValueDictionary, String)。
注解
此方法通过调用 GetVirtualPath 对象的方法 RouteCollection 为 URL 生成适当的值。 它从RequestContext参数获取control对象,并分析参数中的expression路由名称和路由参数。