Create column not connected to model

Oct 18, 2012 at 11:43 AM

Hi,

I'm abit puzzled on how to create an action link without bind it to a model property.

 

Like this:

columns.Add(model => model.IsDeleted).Titled("Action").Sanitized(false).Encoded(false).Width(5).RenderValueAs(model => Html.ActionLink(SiteLabels.Global_Delete, "Delete", "TheController", model.TheId).ToHtmlString());

Here you can se I have model => model.IsDeleted which is the thing I don't want. This property is useless and I don't actually need anything here, since it's just an link. Having it empty doesn't compile.

 

Any suggestions?

Coordinator
Oct 18, 2012 at 11:48 AM

Yes, you true. I am planing to adds this functionallity in the next release

Coordinator
Oct 18, 2012 at 6:53 PM

I have added this functionallity in the 2.0.6 version. You can add columns without spevifing expression. Use empty contructor to do this:

columns => columns.Add().RenderValueAs(model => Html.ActionLink(SiteLabels.Global_Delete, "Delete", "TheController", model.TheId));

In this case you must use RenderValueAs method to specify render epxression for the column.

I will update documentation in a few days.

Oct 18, 2012 at 7:19 PM
Edited Oct 18, 2012 at 7:20 PM

Wow, that's amazing!

Appreciate that you took the time to fix this so quickly. I love the grid!

Oct 25, 2012 at 8:49 AM
Edited Oct 25, 2012 at 8:50 AM

Hey again,

I tried updating through NuGet, but have some problems.

Seems the normal import I earlier used cannot be found:

 

@using GridMvc.Html

And I can't seem to find a way to import the Grid. Any clues?

Coordinator
Oct 25, 2012 at 9:08 AM

I had the same issue and I can't understand why she apears. It seems a bug in package manager. I reopen Visual Studio and all will be fine.

Oct 25, 2012 at 9:23 AM

That fixed it.

Weird. Thanks!