Skip to main content

DevExpressHelper.GetUrl(Object) Method

Returns a URL corresponding to the Controller and Action names passed via a parameter.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public static string GetUrl(
    object routeValues
)

Parameters

Name Type Description
routeValues Object

An object containing the names of the Controller and Action which should handle callbacks on the server.

Returns

Type Description
String

A string specifying the URL generated, based upon the routeValues parameter value.

Remarks

This method can be used to transform an extension’s CallbackRouteValues property value to a URL associated with the corresponding view page.

Examples

  • Grid View:
var grid = Html.DevExpress().GridView(
    settings => {
        settings.Name = "gvEditing";

        settings.CommandColumn.CustomButtons.Add(new GridViewCommandColumnCustomButton() { ID = "my_button", Text = "Custom Button" });
        settings.ClientSideEvents.CustomButtonClick = string.Format("function(s, e) {{ OnCustomButtonClick(s, e, \"{0}\"); }}",
                                    DevExpressHelper.GetUrl(new { Controller = "Controller1", Action = "GoToAction"}));
    ...         
}
@grid.Bind(Model).GetHtml()
  • Menu:
@Html.DevExpress().Menu(settings => {
    settings.Name = "Menu";
    settings.Items.Add(item => {
        item.Text = "Go To Admin Area";
        item.NavigateUrl = DevExpressHelper.GetUrl(new { Area = "Admin", Controller = "Home", Action = "Index" });
    });
    settings.Items.Add(item => {
        item.Text = "Go To User Area";
        item.NavigateUrl = DevExpressHelper.GetUrl(new { Area = "User", Controller = "Home", Action = "Index" });
    });
}).GetHtml()

Online Demo

GridView - External Edit Form

See Also