Control.GetRouteUrl メソッド
定義
ルート パラメーターのセットに対応する URL を取得します。オプションで、ルート名に対応する URL も取得します。Gets the URL that corresponds to a set of route parameters, and optionally to a route name.
オーバーロード
GetRouteUrl(Object) |
ルート パラメーターのセットに対応する URL を取得します。Gets the URL that corresponds to a set of route parameters. |
GetRouteUrl(RouteValueDictionary) |
ルート パラメーターのセットに対応する URL を取得します。Gets the URL that corresponds to a set of route parameters. |
GetRouteUrl(String, Object) |
ルート パラメーターのセットおよびルート名に対応する URL を取得します。Gets the URL that corresponds to a set of route parameters and a route name. |
GetRouteUrl(String, RouteValueDictionary) |
ルート パラメーターのセットおよびルート名に対応する URL を取得します。Gets the URL that corresponds to a set of route parameters and a route name. |
注釈
このメソッドは、コーディングの便宜を実現するために用意されています。This method is provided for coding convenience. これは、RouteCollection.GetVirtualPath メソッドを呼び出すことと同じです。It is equivalent to calling the RouteCollection.GetVirtualPath method.
GetRouteUrl(Object)
ルート パラメーターのセットに対応する URL を取得します。Gets the URL that corresponds to a set of route parameters.
public:
System::String ^ GetRouteUrl(System::Object ^ routeParameters);
public string GetRouteUrl (object routeParameters);
member this.GetRouteUrl : obj -> string
Public Function GetRouteUrl (routeParameters As Object) As String
パラメーター
- routeParameters
- Object
ルート パラメーター。The route parameters.
戻り値
指定されたルート パラメーターに対応する URL。The URL that corresponds to the specified route parameters.
例
次の例は、Control.GetRouteUrl メソッドを呼び出して、productid
と category
という名前のパラメーターを持つルートの URL を取得する方法を示しています。The following example shows how to call the Control.GetRouteUrl method to get the URL of a route that has parameters that are named productid
and category
. この例では、HyperLink1
という名前の HyperLink コントロールが作成されていることを前提としています。This example assumes that you have created a HyperLink control that is named HyperLink1
.
HyperLink1.NavigateUrl = HyperLink1.GetRouteUrl(
New With {.productid = "1", .category = "widgets"})
HyperLink1.NavigateUrl = HyperLink1.GetRouteUrl(
new { productid = "1", category = "widgets" });
注釈
このメソッドは、コーディングの便宜を実現するために用意されています。This method is provided for coding convenience. これは、RouteCollection.GetVirtualPath(RequestContext, RouteValueDictionary) メソッドを呼び出すことと同じです。It is equivalent to calling the RouteCollection.GetVirtualPath(RequestContext, RouteValueDictionary) method. このメソッドは、routeParameters
で渡されたオブジェクトを、RouteValueDictionary.RouteValueDictionary(Object) コンストラクターを使用して RouteValueDictionary オブジェクトに変換します。This method converts the object that is passed in routeParameters
to a RouteValueDictionary object by using the RouteValueDictionary.RouteValueDictionary(Object) constructor.
こちらもご覧ください
GetRouteUrl(RouteValueDictionary)
ルート パラメーターのセットに対応する URL を取得します。Gets the URL that corresponds to a set of route parameters.
public:
System::String ^ GetRouteUrl(System::Web::Routing::RouteValueDictionary ^ routeParameters);
public string GetRouteUrl (System.Web.Routing.RouteValueDictionary routeParameters);
member this.GetRouteUrl : System.Web.Routing.RouteValueDictionary -> string
Public Function GetRouteUrl (routeParameters As RouteValueDictionary) As String
パラメーター
- routeParameters
- RouteValueDictionary
ルート パラメーター。The route parameters.
戻り値
指定されたルート パラメーターに対応する URL。The URL that corresponds to the specified route parameters.
例
次の例は、このメソッドを呼び出して、productid
と category
という名前のパラメーターを持つルートの URL を取得する方法を示しています。The following example shows how to call this method to get the URL of a route that has parameters that are named productid
and category
. この例では、HyperLink1
という名前の HyperLink コントロールが作成されていることを前提としています。This example assumes that you have created a HyperLink control that is named HyperLink1
.
HyperLink1.NavigateUrl = HyperLink1.GetRouteUrl(
new RouteValueDictionary {productId="1", category="widgets"})
HyperLink1.NavigateUrl = HyperLink1.GetRouteUrl(
(new RouteValueDictionary {productId="1", category="widgets"});
注釈
このメソッドは、コーディングの便宜を実現するために用意されています。This method is provided for coding convenience. これは、RouteCollection.GetVirtualPath(RequestContext, RouteValueDictionary) メソッドを呼び出すことと同じです。It is equivalent to calling the RouteCollection.GetVirtualPath(RequestContext, RouteValueDictionary) method.
こちらもご覧ください
GetRouteUrl(String, Object)
ルート パラメーターのセットおよびルート名に対応する URL を取得します。Gets the URL that corresponds to a set of route parameters and a route name.
public:
System::String ^ GetRouteUrl(System::String ^ routeName, System::Object ^ routeParameters);
public string GetRouteUrl (string routeName, object routeParameters);
member this.GetRouteUrl : string * obj -> string
Public Function GetRouteUrl (routeName As String, routeParameters As Object) As String
パラメーター
- routeName
- String
ルートの名前。The name of the route.
- routeParameters
- Object
ルート パラメーター。The route parameters.
戻り値
指定したルート パラメーターおよびルート名に対応する URL。The URL that corresponds to the specified route parameters and route name.
例
次の例では、このメソッドを呼び出して Product
という名前のルートの URL を取得し、productid
と category
という名前のパラメーターを持つ方法を示します。The following example shows how to call this method to get the URL of a route that is named Product
and has parameters that are named productid
and category
. この例では、HyperLink1
という名前の HyperLink コントロールが作成されていることを前提としています。This example assumes that you have created a HyperLink control that is named HyperLink1
.
HyperLink1.NavigateUrl = HyperLink1.GetRouteUrl("Product",
New With {.productid = "1", .category = "widgets"})
HyperLink1.NavigateUrl = HyperLink1.GetRouteUrl("Product",
new { productid = "1", category = "widgets" });
注釈
このメソッドは、コーディングの便宜を実現するために用意されています。This method is provided for coding convenience. これは、RouteCollection.GetVirtualPath(RequestContext, String, RouteValueDictionary) メソッドを呼び出すことと同じです。It is equivalent to calling the RouteCollection.GetVirtualPath(RequestContext, String, RouteValueDictionary) method. このメソッドは、routeParameters
で渡されたオブジェクトを、RouteValueDictionary.RouteValueDictionary(Object) コンストラクターを使用して RouteValueDictionary オブジェクトに変換します。This method converts the object that is passed in routeParameters
to a RouteValueDictionary object by using the RouteValueDictionary.RouteValueDictionary(Object) constructor.
こちらもご覧ください
GetRouteUrl(String, RouteValueDictionary)
ルート パラメーターのセットおよびルート名に対応する URL を取得します。Gets the URL that corresponds to a set of route parameters and a route name.
public:
System::String ^ GetRouteUrl(System::String ^ routeName, System::Web::Routing::RouteValueDictionary ^ routeParameters);
public string GetRouteUrl (string routeName, System.Web.Routing.RouteValueDictionary routeParameters);
member this.GetRouteUrl : string * System.Web.Routing.RouteValueDictionary -> string
Public Function GetRouteUrl (routeName As String, routeParameters As RouteValueDictionary) As String
パラメーター
- routeName
- String
ルートの名前。The name of the route.
- routeParameters
- RouteValueDictionary
ルート パラメーター。The route parameters.
戻り値
指定したルート パラメーターおよびルート名に対応する URL。The URL that corresponds to the specified route parameters and route name.
例
次の例では、このメソッドを呼び出して Product
という名前のルートの URL を取得し、productid
と category
という名前のパラメーターを持つ方法を示します。The following example shows how to call this method to get the URL of a route that is named Product
and has parameters that are named productid
and category
. この例では、HyperLink1
という名前の HyperLink コントロールが作成されていることを前提としています。This example assumes that you have created a HyperLink control that is named HyperLink1
.
HyperLink1.NavigateUrl = HyperLink1.GetRouteUrl("Product",
new RouteValueDictionary {productId="1", category="widgets"})
HyperLink1.NavigateUrl = HyperLink1.GetRouteUrl("Product",
(new RouteValueDictionary {productId="1", category="widgets"});
注釈
このメソッドは、コーディングの便宜を実現するために用意されています。This method is provided for coding convenience. これは、RouteCollection.GetVirtualPath(RequestContext, String, RouteValueDictionary) メソッドを呼び出すことと同じです。It is equivalent to calling the RouteCollection.GetVirtualPath(RequestContext, String, RouteValueDictionary) method.