RouteUrlExpressionBuilder Class

RouteUrlExpressionBuilder Class

.NET Framework (current version)
 

Creates a URL that corresponds to specified URL parameter values.

Namespace:   System.Web.Compilation
Assembly:  System.Web (in System.Web.dll)

System.Object
  System.Web.Compilation.ExpressionBuilder
    System.Web.Compilation.RouteUrlExpressionBuilder

public class RouteUrlExpressionBuilder : ExpressionBuilder

NameDescription
System_CAPS_pubmethodRouteUrlExpressionBuilder()

Initializes a new instance of the RouteUrlExpressionBuilder class.

NameDescription
System_CAPS_pubpropertySupportsEvaluate

Gets a value that indicates whether an expression can be evaluated in a page that is not compiled.(Overrides ExpressionBuilder.SupportsEvaluate.)

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodEvaluateExpression(Object, BoundPropertyEntry, Object, ExpressionBuilderContext)

Creates a URL that corresponds to specified URL parameter values and to a route URL format.(Overrides ExpressionBuilder.EvaluateExpression(Object, BoundPropertyEntry, Object, ExpressionBuilderContext).)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetCodeExpression(BoundPropertyEntry, Object, ExpressionBuilderContext)

Returns a code expression that is used to perform the property assignment in the generated page class.(Overrides ExpressionBuilder.GetCodeExpression(BoundPropertyEntry, Object, ExpressionBuilderContext).)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetRouteUrl(Control, String)

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

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodParseExpression(String, Type, ExpressionBuilderContext)

When overridden in a derived class, returns an object that represents the parsed expression.(Inherited from ExpressionBuilder.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticTryParseRouteExpression(String, RouteValueDictionary, String)

Parses an expression into a collection of route keys and values, and optionally into a route name.

The RouteUrlExpressionBuilder class makes it possible to set the property of a server control to the URL of a route by providing a list of URL parameter values.

The following example shows how to create markup that generates a hyperlink with a URL that is formatted for a route. The route is defined by using http://www.contoso.com/search/{searchterm} as the URL pattern.

<asp:HyperLink ID="HyperLink1" runat="server"
               NavigateUrl="<%$ RouteUrl:searchterm=Bicycles %>">
  Search for Bicycles
</asp:HyperLink>

The URL generated for this hyperlink would be http://www.contoso.com/search/Bicycles.

If the URL parameters provided to the RouteUrl expression are not sufficient to uniquely identify a route, you must include the route name. For example, if a Web application has two routes with searchterm as the sole URL parameter, the routes would have to be defined by using route names, and the hyperlink markup would resemble the following example:

<asp:HyperLink ID="HyperLink1" runat="server"
               NavigateUrl="<%$ RouteUrl:searchterm=Bicycles,
               routename=BasicSearchRoute %>">
  Search for Bicycles
</asp:HyperLink>

.NET Framework
Available since 4.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft