t4mvc

T4MVC and Ajax method with parameter

陌路散爱 提交于 2020-01-24 22:14:47
问题 I am trying to apply T4MVC to my project. Say, I have an ajax search box, it calls Home/SearchQuery action which takes in a string q as parameter. How do I write that line in T4MVC? From Ajax.BeginForm("SearchQuery", "Home", .... To Ajax.BeginForm(MVC.Home.SearchQuery(???)... .cshtml file @using (Ajax.BeginForm("SearchQuery", "Home", /* <-----Convert to T4MVC Here */ new AjaxOptions { LoadingElementId = "loadingGif", OnSuccess = "parseResults", OnFailure = "searchFailed" })) { <input type=

Strongly-typed T4MVC Action/ActionLink

▼魔方 西西 提交于 2020-01-22 06:58:25
问题 I've been using T4MVC (FYI: v2.6.62) for quite some time, and I've been slowly moving over our code to this way of working (less reliance on magic strings). But I've had to stop because, for some reason, T4MVC is unable to translate objects into urls, and only seems to be able to work on primitive types (int/string/etc). Here is an example: Route breakdown: /MyController/MyAction/{Number}/{SomeText} Class: namespace MyNamespace { public class MyClass { public int Number { get; set; } public

Strongly-typed T4MVC Action/ActionLink

旧城冷巷雨未停 提交于 2020-01-22 06:58:05
问题 I've been using T4MVC (FYI: v2.6.62) for quite some time, and I've been slowly moving over our code to this way of working (less reliance on magic strings). But I've had to stop because, for some reason, T4MVC is unable to translate objects into urls, and only seems to be able to work on primitive types (int/string/etc). Here is an example: Route breakdown: /MyController/MyAction/{Number}/{SomeText} Class: namespace MyNamespace { public class MyClass { public int Number { get; set; } public

What is the difference between these 2 definitions in T4Mvc?

纵饮孤独 提交于 2020-01-15 05:54:08
问题 In my razor view I have the following: var url = "@Url.Action(Mvc.Leads.GetAllLeads())" var url2 = "@Url.Action(Mvc.Leads.Actions.GetAllLeads())" They both appear to generate the same Url. Why the actions property? 回答1: In short, no. The Actions property is there for backward compat with a really early version of T4MVC. But it may be better to yank it altogether now to avoid confusion. 来源: https://stackoverflow.com/questions/8536269/what-is-the-difference-between-these-2-definitions-in-t4mvc

AsyncController in MVC2 and T4MVC: can they work together?

丶灬走出姿态 提交于 2020-01-14 05:39:21
问题 Async actions in AsyncControllers (in MVC2) have two action methods (ActionNameAsync and ActionNameCompleted) which seem to confuse T4MVC. If it can't be done with T4MVC, is there a way to disable it from trying to include these methods? 回答1: Indeed, async controllers don't currently work with T4MVC. Here was a thread discussing it: http://forums.asp.net/t/1534619.aspx Is this causing something to break for you, or is it simply that T4MVC is not available for those methods, but everything

T4MVC and Resharper Navigation

天涯浪子 提交于 2020-01-13 10:55:11
问题 I frequently use Resharper's 'Go to Declaration' (ctrl + b in the Resharper Default Keymapping) keyboard shortcut to help with navigation within VS2010. Before I included a reference to T4MVC in my application, I would use "string refrences" and Resharper would know where I 'meant' to go. For example: @Html.Partial("_Continents" ) When I would use ctrl+b on the string "_Continents" , Resharper knew I wanted to go to the partial view named _Continents.cshtml. Since I have started using T4MVC,

Is there an equivalent of T4MVC for webforms?

北战南征 提交于 2020-01-04 02:46:08
问题 I use T4MVC inside my asp mvc projects, mostly because it's brilliant. Is there an equivalent for asp webforms? 回答1: It turns out David Ebbo (he also did the T4MVC stuff) has given asp webforms a little love as well: http://blogs.msdn.com/davidebb/archive/2009/07/12/asppathguru-a-little-t4-love-for-asp-net-webforms.aspx 回答2: PageMethods provide some strongly typed capabilities for WebForms 来源: https://stackoverflow.com/questions/2446679/is-there-an-equivalent-of-t4mvc-for-webforms

Regexp-replace: Multiple replacements within a match

倖福魔咒の 提交于 2020-01-03 11:25:09
问题 I'm converting our MVC3 project to use T4MVC. And I would like to replace java-script includes to work with T4MVC as well. So I need to replace "~/Scripts/DataTables/TableTools/TableTools.min.js" "~/Scripts/jquery-ui-1.8.24.min.js" Into Scripts.DataTables.TableTools.TableTools_min_js Scripts.jquery_ui_1_8_24_min_js I'm using Notepad++ as a regexp tool at the moment, and it is using POSIX regexps. I can find script name and replace it with these regexps: Find: \("~/Scripts/(.*)"\) Replace with

cannot implicitly convert type void to object. .NET MVC PartialViewResult

两盒软妹~` 提交于 2019-12-31 10:56:28
问题 I have the following controller action: [ChildActionOnly] public virtual PartialViewResult ListActions(int id) { var actions = meetingActionRepository.GetAllMeetingActions(id); return PartialView(actions); } And the following action link (using t4MVC and the razor syntax) <p> @Html.RenderAction(MVC.MeetingActions.ListActions(Model.MeetingId)) </p> However this gives me the error: cannot implicitly convert type void to object As far as i can tell the controller action is ok, so what could be

Cannot get T4MVC to work with VS2010 and ASP.NET MVC 2

萝らか妹 提交于 2019-12-29 06:52:10
问题 I'm trying to add the T4MVC templates to my project, but I'm experiencing some problems. I went to Codeplex and downloaded the latest version of T4MVC, and according to the instructions I just copied the two files T4MVC.tt and T4MVC.Settings.t4 into the root of my web application. Immediately, I got the following errors: From T4MVC.cs (generated file): A namespace cannot directly contain members such as fields or methods From T4MVC.tt (the code generating template): Compiling transformation: