mvccontrib

mvccontrib test helper and verifying http post routes and parameters

这一生的挚爱 提交于 2019-12-19 03:15:13
问题 In my Asp.net MVC app, I have two methods on a controller, one for when the user first arrives on the view and then one when they submit the form on said view. public ActionResult Foo() {} [AcceptVerbs(HttpVerbs.Post)] public ActionResult Foo(string id, Account accountToFoo) {} In the second action, there's a custom model binder that's assembling the account object that I'm acting on, though that's really not important. This all works fine in testing locally on a server. We try to be pretty

mvccontrib test helper and verifying http post routes and parameters

╄→尐↘猪︶ㄣ 提交于 2019-12-19 03:15:02
问题 In my Asp.net MVC app, I have two methods on a controller, one for when the user first arrives on the view and then one when they submit the form on said view. public ActionResult Foo() {} [AcceptVerbs(HttpVerbs.Post)] public ActionResult Foo(string id, Account accountToFoo) {} In the second action, there's a custom model binder that's assembling the account object that I'm acting on, though that's really not important. This all works fine in testing locally on a server. We try to be pretty

MVC3 doesn't recognize MvcContrib namespace in Razor View

北慕城南 提交于 2019-12-18 19:28:24
问题 I'm trying to paginate something with MvcContrib's Html.Pager() , but my razor views can't reference the right namespace. Controller is ok: using MvcContrib.Pagination; ... public ActionResult List(int? page) { return View(new UserRepository().GetUserList().AsPagination(page ?? 1, 10)); } But, the view can't make sense of either: @using MvcContrib OR @Html.Pager((IPagination)Model) I installed MvcContrib via NuGet. I tried adding MvcContrib , MvcContrib.UI and MvcContrib.UI.Html namespaces to

ASP.NET MVC 3, Razor Views, and Portable Areas

那年仲夏 提交于 2019-12-18 10:24:58
问题 I am trying to using portable views with ASP.NET MVC 3 and razor views as that seems like the best way to create an easy plug-in architecture. So I have my class library setup and I have my view located in /Views/Admin/Index.cshtml and it is set as an Embedded Resource. I then include that project as a dependency for the main web application project. When I try to access the Admin controller, Index action I get a message that is can't find that view file (so the controller is being properly

Reflecting parameter name: abuse of C# lambda expressions or Syntax brilliance?

試著忘記壹切 提交于 2019-12-17 06:19:15
问题 I am looking at the MvcContrib Grid component and I'm fascinated, yet at the same time repulsed, by a syntactic trick used in the Grid syntax: .Attributes(style => "width:100%") The syntax above sets the style attribute of the generated HTML to width:100% . Now if you pay attention, 'style' is nowhere specified, is deduced from the name of the parameter in the expression! I had to dig into this and found where the 'magic' happens: Hash(params Func<object, TValue>[] hash) { foreach (var func

mvccontrib test helper and verifying http post routes and parameters

独自空忆成欢 提交于 2019-12-13 04:39:45
问题 Here's an example. Assuming you have the following action: public AccountController : Controller { [AcceptVerbs(HttpVerbs.Post)] public ActionResult Foo(string id) { return View(); } } And the following route registered: RouteTable.Routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "home", action = "index", id = "" } ); I test it like this: var routeData = "~/account/foo".WithMethod(HttpVerbs.Post); routeData.Values["id"] = "123"; routeData.ShouldMapTo

Convert C# to VB.Net - Using MVCContrib Blockrenderer to render a partial view to a string

流过昼夜 提交于 2019-12-13 04:10:11
问题 I need to render a partialview to a string, and I am trying to convert a C# example to VB.Net, as I am stuck with that for this project. This is causing me a headache from these two problems: ObjectViewData - I can't figure out what that is RenderPartial is a sub, but seems to be used as a function - I don' get it I reference the MVCContrib.UI, so I don't need to convert that. But these two functions, I do need to convert: (from brightmix.com) /// Static Method to render string - put

Sorting with MVCContrib

左心房为你撑大大i 提交于 2019-12-13 02:15:28
问题 Does anyone know how to sort the MVCContrib grid when using a complex object. My grid is displaying a list of Person and I'm trying to sort on the Country property. The problem is that Country is a property an Address class which is a property of Person. Person.Address.Country <%Html.Grid(Model).Columns(column => { column.For(x => x.Id); column.For(x => x.FirstName); column.For(x => x.LastName).Sortable(false); column.For(x => x.Address.Country).Sortable(false); column.For(x => x.Age)

Bind MvcContrib grid contents to view model on postback

眉间皱痕 提交于 2019-12-13 01:43:07
问题 A form in my MVC4 application shows order information. The model for the view is OrderViewModel. It has a property Orderlines which is a collection of order lines. I'm using MvcContrib Grid to show the order lines. When the form is submitted, the following controller method executes: [HttpPost] public ActionResult PlaceOrder(OrderViewModel model) { ... } My problem is that the Orderlines property is always null in the incoming model parameter. Other fields like customer name are bound from

How to produce XML with attributes rather than nodes, using MvcContrib's XmlResult?

旧城冷巷雨未停 提交于 2019-12-12 19:25:25
问题 I'm trying to generate an XML output from a type in C#. I'm Using the MvcContrib XmlResult class, which I've included a link to below. As a simple test to see if I could get it working, I'm using the following code: var topTen = new TopTen { PerformanceTo = DateTime.Now, ShareClasses = new List<TopTenShareClass>() { new TopTenShareClass{Id = 1, Name = "a"}, new TopTenShareClass{Id = 2, Name = "b"}, new TopTenShareClass{Id = 3, Name = "c"} } }; return new XmlResult(topTen); (with the 2 types