Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Using Umbraco 7.2.8 and I have a view and I want to pass some data down the the doc type grid partial, so in my main template I have:
@Model.Content.GetGridHtml("mainContentGrid", "contentGrid", new ViewDataDictionary { { "currentProduct", productModel } })
Then in my view for the grid component partial
var productModel = (ProductModel) ViewData["currentProduct"];
however that is always null. Is this even possible if not then how do i do it?
Regards
Ismail
Hi Ismail,
I'm doing something similar, but am passing the data from the grid partial into the grid editor;
@Html.Partial("grid/editors/base", (object)control, new ViewDataDictionary { { "css", "mega-menu" } })
Then in the grid editor I use ViewBag to get at the data:
@ViewBag.css
I'm not sure if this is best practice, but it's working for me :)
Cheers,
James
James,
I have what i need to pass in my main view i tried passing through using viewdata but no joy. For now just to get things working i use session feels dirty as hell but works.
Must be a better way.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Passing data from view to doctype grid editor view
Using Umbraco 7.2.8 and I have a view and I want to pass some data down the the doc type grid partial, so in my main template I have:
Then in my view for the grid component partial
however that is always null. Is this even possible if not then how do i do it?
Regards
Ismail
Hi Ismail,
I'm doing something similar, but am passing the data from the grid partial into the grid editor;
Then in the grid editor I use ViewBag to get at the data:
I'm not sure if this is best practice, but it's working for me :)
Cheers,
James
James,
I have what i need to pass in my main view i tried passing through using viewdata but no joy. For now just to get things working i use session feels dirty as hell but works.
Must be a better way.
Regards
Ismail
is working on a reply...