Muokkaa

Jaa


RouteUrlExpressionBuilder.GetRouteUrl(Control, String) Method

Definition

Creates a URL that corresponds to specified route keys for a route URL format.

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

Parameters

control
Control

The control that the expression is bound to.

expression
String

The expression as specified in markup.

Returns

The URL that corresponds to the route URL format of the current Route object.

Exceptions

The control parameter is null.

The method was unable to parse the expression that was specified in markup. For more information, see TryParseRouteExpression(String, RouteValueDictionary, String).

Remarks

This method generates the appropriate value for the URL by calling the GetVirtualPath method of the RouteCollection object. It gets the RequestContext object from the control parameter, and it parses the route name and route parameters from the expression parameter.

Applies to

See also