Επεξεργασία

Κοινή χρήση μέσω


VirtualPathData.VirtualPath Property

Definition

Gets or sets the URL that was created from the route definition.

public:
 property System::String ^ VirtualPath { System::String ^ get(); void set(System::String ^ value); };
public string VirtualPath { get; set; }
member this.VirtualPath : string with get, set
Public Property VirtualPath As String

Property Value

The URL that was generated from a route.

Examples

The following example shows a control that creates a URL based on a route that has parameters that are named action and categoryName.

RouteValueDictionary parameters = new RouteValueDictionary { { "action", "show" }, { "categoryName", "bikes" } };
VirtualPathData vpd = RouteTable.Routes.GetVirtualPath(null, parameters);
HyperLink1.NavigateUrl = vpd.VirtualPath;
Dim vpd As VirtualPathData
Dim parameters As RouteValueDictionary

parameters = New RouteValueDictionary(New With {.action = "show", .categoryName = "bikes"})
vpd = RouteTable.Routes.GetVirtualPath(Nothing, parameters)
HyperLink1.NavigateUrl = vpd.VirtualPath

Remarks

To generate a URL, you call the GetVirtualPath method. That method returns an instance of the VirtualPathData class, which contains information about the route. The VirtualPath property contains the generated URL.

Applies to

See also