This is a migrated thread and some comments may be shown as answers.
Toolbar Route not working
0 Answers 27 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Peter Felice
Top achievements
Rank 1
Peter Felice asked on 27 Feb 2011, 10:46 PM

Hi There,

I am using a custom toolbar command to create a button in the toolbar of a grid in order to link to a new page. In one instance, it works perfectly as expected:

.ToolBar(commands => commands.Custom()
    .Text("Create New Company")
    .Action("Create", "Companies"))

which generates the following HTML as expected:

<a class="t-button t-grid-update" href="/Companies/Create">Create New Company</a>

Now, on another page, i need to do the same things, but use a named route, rather then an action. This unfortunatly does not work:

.ToolBar(commands => commands.Custom()
     .Text("Create New Location")
     .Route("CompanyLocation", new { companyId = @Model.Id, action = "Create" }))

This creates an anchor tag with the href parameter set to "". On the same page, if I use this HTML helper:

@Html.RouteLink("Create New Location", "CompanyLocation", new { companyId = @Model.Id, action = "Create" })

I get the proper link that I expected. Am I doing something wrong when trying to used a named route for a custom command?

Tags
Grid
Asked by
Peter Felice
Top achievements
Rank 1
Share this question
or