Questions tagged [t4mvc]

T4MVC is an open source utility for Microsoft ASP.NET MVC. It allows replacing magic strings in Views, Controllers and Links to content with strong names/types.

T4MVC is an open source utility for Microsoft ASP.NET MVC. It allows replacing magic strings in Views, Controllers and Links to content with strong names/types.

Resources

245 questions
2
votes
2 answers

Specifying partial view path using T4MVC

I am using T4MVC in our ASP.NET MVC project. I have a statement like this in my view: <% Html.RenderPartial(MVC.SomeController.Views.PartialViewName); %> Which was previously like this: <% Html.RenderPartial("../SomeController/PartialViewName");…
Mahesh Velaga
  • 21,633
  • 5
  • 37
  • 59
2
votes
2 answers

Can I force T4MVC not to take a parameter from the URL of the current view, when generating new anchors within the view?

I have an ASP.Net MVC4 application, where I use T4MVC for conveniently generating anchor-elements within my views. Something like this: @Html.ActionLink("Application 1", MVC.Application.Overview(1)) I have two routes in my…
Christofer Eliasson
  • 32,939
  • 7
  • 74
  • 103
2
votes
1 answer

Generate T4MVC url inside ApiController

Is there a way to generate a Url that is not part of an ApiController inside a ApiController using T4MVC? I dont have an option to do so. controller.Url is null when I run the code below. var controller = new UrlController(); …
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
2
votes
2 answers

T4MVC Optional Parameter Inferred From Current Context

I have read the other post about this at T4MVC OptionalParameter values implied from current context and I am using the latest T4MVC (2.11.1) which is suppose to have the fix in. I even checked checked to make sure that it's there -- and it is. I am…
Itakou
  • 23
  • 4
2
votes
2 answers

why T4MVC introduces virtual for controller actions?

Why does T4MVC uses virtual for controller methods? Changing a public ActionResult Details (string Id) to: public virtual ActionResult Details (string Id) I have already seen other questions about T4MVC but didn't understand why.
pdjota
  • 3,163
  • 2
  • 23
  • 33
2
votes
1 answer

T4MVC - Actions with model binding - how to get a fully qualified strongly-typed URL string to another Controller?

I'm running Visual Studio 2012 RC with the .Net 4.5 bits with T4MVC. I'm in an Action method for my AccountController and I want to generate a fully qualified URL for another controller which looks something like this; public partial class…
cirrus
  • 5,624
  • 8
  • 44
  • 62
2
votes
4 answers

RedirectToAction from base controller

I was trying to execute RedirectToAction(actionResult) from my base controller but IntelliSense didn't show this overload. I have found out RedirectToAction is placed into every T4MVC controller partial class. I kind of understand why it was…
SiberianGuy
  • 24,674
  • 56
  • 152
  • 266
2
votes
0 answers

T4MVC How to Exclude Individual Files

Is there a way to exclude certain controllers or individual files from T4MVC?
Ryan
  • 4,354
  • 2
  • 42
  • 78
2
votes
2 answers

T4MVC and Html.BeginForm

I have action method [HttpPost] public virtual ActionResult Search(string searchTerm) ... And Form @using (Html.BeginForm(MVC.Products.Search(), FormMethod.Post)) {
1110
  • 7,829
  • 55
  • 176
  • 334
2
votes
1 answer

asp.net mvc 3: reverse of modelbinder while serializing to url

In our application we have an object which is called a search descriptor. We have a custom modelbinder for it to make it all work. It reads certain know properties like q oorsort and page from the URL (or post data). Now somewhere else in the…
Jaap
  • 3,081
  • 2
  • 29
  • 50
1
vote
1 answer

How do I substitute dynamic parameter values to T4MVC using razor?

Consider following: $("#myform").attr({ action: "@Url.Action(MVC.Thing.Delete().AddRouteValue("id", myJsModel.Id )) }); I'm trying to set the action method of the form to a strongly typed T4MVC route. How do I insert a dynamic value from…
jaffa
  • 26,770
  • 50
  • 178
  • 289
1
vote
1 answer

T4MVC creates incorrect URL for ActionLink when using Areas

In my project I'm trying to create an URL in a view inside an area. The code is this: @Html.ActionLink("Cancel", MVC.MyArea.MyController.Index(), new { @class = "btn" }) When I view the result in the browser, the generated code is the following:
Nelson Reis
  • 4,780
  • 9
  • 43
  • 61
1
vote
3 answers

T4MVC ModelBinding

I had the following Action: public ActionResult GetCityObjects(string cityAlias) By some reasons I added a custom ModelBinder: public ActionResult GetCityObjects(City city) Now I want to make T4MVC add "cityAlias" parameter with value city.Alias…
SiberianGuy
  • 24,674
  • 56
  • 152
  • 266
1
vote
1 answer

T4MVC support for Portable Areas

What does this in T4MVC.Settings file mean: // You can list folders containing portable areas here readonly string[] PortableAreas = new string[] { "" What does it mean "You can list folders containing portable areas here"? We know that…
mare
  • 13,033
  • 24
  • 102
  • 191
1
vote
1 answer

T4MVC Actions token

Actions token was removed from T4MVC. So do I understand right there is no short syntax for referencing Action inside the same Controller?
SiberianGuy
  • 24,674
  • 56
  • 152
  • 266