mvccontrib

MVCContrib Grid showing headers when empty?

The elegant Action Syntax in the MVCContrib Grid gives us the Empty() method. However, the default behavior of MvcContrib.UI.Grid.GridRenderer<T>.RenderHeader() is to hide the table column headers when the grid is empty. Is there a way to show headers when data is not present that does not require a major refactoring? Now I have heard o...

Cannot redirect after HTTP headers have been sent

Hi Guys, I'm using MVCContrib and its EmailTemplateService to send html email. Send email works fine but it doesn't seem to dispose email view properly. When I try to redirect to a new Action it gives the following error: "Cannot redirect after HTTP headers have been sent" Does anyone know how to fix this problem. Many thanks Sandra...

How To Write Unit Test For Method Returning JsonResult With RenderPartialViewToString?

If you look at the example at this link: http://www.atlanticbt.com/blog/asp-net-mvc-using-ajax-json-and-partialviews/ How would one write a unit test for the JsonAdd method? I have a similar situation in my own code, but the RenderPartialViewToString errors when calling: ViewEngineResult viewResult = ViewEngines.Engines.FindPartial...

MvcContrib Controller Test Returning Weird Results

I have a simple controller test using MvcContrib's test helpers: var controller = new HomeController(); var result = controller.Contact(); result.AssertViewRendered().ForView("Contact").WithViewData<ContactViewModel>(); The only problem is, the controller method currently only returns a view, it is NOT setting a view model yet. Why wo...

MVC Mock HttpContextBase which is used in a helper

I am using a helper in my controllers and in my views that I have found somewhere on the internet. The helper is called like this in my controller "Url.SiteRoot();" How can I get my controller to not throw an Exception whenever the helper is called? I am using MVCContrib and moq for my unit tests. I am thinking of implementing some kind...

Html.Grid: What is IGridColumn.Attributes()?

Hi, I am new to MVC2 and I am using Html.Grid on my view. I would like to know what Attributes() is in the following context and for what purpose and how it is used? <%= Html.Grid<MyViewModel>(Model.MyPagedList) .Columns( column => { column.For(x => x.Amount).Attributes(... I couldn't find much on Google. Tha...

Html.Grid right align data in column

Hi, In an Html.Grid, how can we ensure that data in the column (e.g. currency amounts) gets right aligned? Thanks. ...

asp.net MVC: RescueAttribute (mvccontrib) vs HandleErrrorsAttribute?

Hi there, I recently came across the rescue attribute which is part of the mvccontrib project... At first glance it appeared to allow you to server up different error views depending on controller / actions etc.. But taking a closer look, it also appears that the standard HandleError attribute that ships with mvc also allows you to do ...

Decoding Html string in mvcContrib

Hi, My question is simple. How do I decode Html characters in mvc contrib grid? I want those to be rendered inside textarea after decoding. But unfortunately its all encoded information what I get inside textarea. Following is how I'm trying to do this... column.For ( cust => Html.TextArea("Customer", new HtmlString(cust.Address), 4, ...

Html.Grid containing checkbox per row

Hi, I am using Html.Grid in my asp.net MVC2 application. The grid contains checkboxes per row. <%= Html.Grid<MyViewModel>(Model.MyList) .Columns( column => { column.For(x => Html.CheckBox("Select", false, new { id = x.ID })).DoNotEncode(); I need to loop through the checked records and action them. How can I ret...

What is the state of ASP.NET MVC Contrib UI Testing Helpers?

Back in April I was listening to Herding Code episode 77 about MvcContrib. There Eric Hexter announced UI Testing Helpers as a big upcoming feature. Now several months later I was searching the web for any information about UI testing with MvcContrib. Unfortunately I found almost nothing: This sneek peek: http://codepaste.net/cw8ie4 ...

MVCContrib Grid and nun-nullable parameter

I'm using the MVCContrib Grid. My controller action accepts 3 parameters, the sortoptions and paging parameter for the grid, and a ResourceID parameter, that specifies which resource you want to view bids for. When i click on the links i get the following error The parameters dictionary contains a null entry for parameter 'Resource...

MvcContrib Pager Styling

Is it possible to style the MvcContrib pager to just show "1 2 3 4 ..." for paging? ...

pro's and cons of MEF vs Portable Areas via MvcContrib for collaborative programming

I've been looking into MEF and Portable areas and the pro's and cons of using these in a collaborative programming environment. I've found the following article http://www.thegecko.org/index.php/2010/06/pluggable-mvc-2-0-using-mef-and-strongly-typed-views/ which states MEF was chosen over other solutions such as Portable Areas ...

How to use mvcContrib template gallery for asp.net mvc?

Has any one ever downloaded and made use of the mvcContrib template gallery for asp.net mvc. I cant find where to download the templates from and there is no documentation for how to use it? ...

mvc contrib grid - pager

Hi, I am using the mvc contrib grid and generate the pager like this: <%= Html.Pager((IPagination)Model) %> This produces something like this: Showing 11 - 20 of 200 first | prev | next | last Is there a simple way to produce something like this which shows 'neighboring pages': Showing 11 - 20 of 200 first | prev | 1 2 3 4 ... | n...

Viewmodel to allow sorting and filtering for mvc contrib grid

In my attempt to enable sorting and filtering in conjunction with the MVC contrib. grid I have decided to use a Viewmodel which contains the grid data plus the sorting and filtering information. I added a form under the grid and the Viewmodel is used to maintain the state of the form and to carry the data for the grid: public class Gri...

MvcContrib : returning an existing ViewResult does not redirect to the correct page.

I've the following scenario: Go to the /User.mvc?userId=200&otherId=1 page. Change some data. Press Update button. Show the /User.mvc?userId=200&otherId=1 page. I used MvcContrib + T4MVC with the following code: [AllRolesAuthorize()] public virtual ViewResult Index(long? userId, long? subPracticeId) { long selectedUserId = userI...

Sharing MasterPages and styles/other media between ASP.NET MVC sites, using MVCContrib PortableAreas

Any way to have a Portable Area containing resources common to several MVC applications (when added as a reference to the project depending on it)? Wanting to have a 'Core' set of pages, styles, masterpages, javascript etc, but not found an easy way to do this. Tried a few things to reference the master page, but not had any luck. The f...

Html.EditorFor in an MVCContrib PortableArea

I am trying to use Html.EditorFor in a Portable Area (i.e. so create and edit use the same form), but it doesn't seem to working (fine when it is not in the Portable Area though). In the page, I just have: <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MySite.Models.DocumentType>" %>...