EditContainerAttributes

Nov 8, 2011 at 12:58 AM

Hi There,

On the DataGrid I see that you can specify EditContainerAttributes, can you please give me an example of how we access these within the Edit template itself.

For example I have the following in my view. How do I access the UseUnits within the PortfolioSetEditItem (and all the other templates). I've tried VIewBag["UseUnits"] but that didn't seem to work.

@Html.DataGridFor(model => model.PortfolioAllocations, ItemContainerType.tr, "PortfolioSetEditItem""PortfolioSetDisplayItem""PortfolioSetGrid""PortfolioSetInsertItem", editContainerAttributes: new Dictionary<stringobject> {{ "UseUnits"true }})

Cheers 

Craig
Coordinator
Nov 8, 2011 at 8:31 PM

The EditContainerAttributes are just Html attributes (like css, or style) that you can add to the ItemContainer, that in your case is a tr. For instance, if you specify style = "width:100px;", you will have a tr like this:

<tr  style = "width:100px;">.

If you would like to pass ViewData of your main view to your edit template, pls specify the template with an in line helper that is defined in the same view of the DataGridFor, then

you can access to the ViewData of the main View from within the template.

Nov 8, 2011 at 8:47 PM
Great, thank you

On Wed, Nov 9, 2011 at 10:32 AM, frankabbruzzese <notifications@codeplex.com> wrote:

From: frankabbruzzese

The EditContainerAttributes are just Html attributes (like css, or style) that you can add to the ItemContainer, that in your case is a tr. For instance, if you specify style = "width:100px;", you will have a tr like this:

.

If you would like to pass ViewData of your main view to your edit template, pls specify the template with an in line helper that is defined in the same view of the DataGridFor, then

you can access to the ViewData of the main View from within the template.

Read the full discussion online.

To add a post to this discussion, reply to this email (MVCControlsToolkit@discussions.codeplex.com)

To start a new discussion for this project, email MVCControlsToolkit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com