{"action":"opened","issue":{"url":"https://api.github.com/repos/mikeedwards83/Glass.Mapper/issues/124","labels_url":"https://api.github.com/repos/mikeedwards83/Glass.Mapper/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/mikeedwards83/Glass.Mapper/issues/124/comments","events_url":"https://api.github.com/repos/mikeedwards83/Glass.Mapper/issues/124/events","html_url":"https://github.com/mikeedwards83/Glass.Mapper/issues/124","id":70215075,"number":124,"title":"How to retrieve ItemRendering item?","user":{"login":"SanderSchutten","id":12073499,"avatar_url":"https://avatars.githubusercontent.com/u/12073499?v=3","gravatar_id":"","url":"https://api.github.com/users/SanderSchutten","html_url":"https://github.com/SanderSchutten","followers_url":"https://api.github.com/users/SanderSchutten/followers","following_url":"https://api.github.com/users/SanderSchutten/following{/other_user}","gists_url":"https://api.github.com/users/SanderSchutten/gists{/gist_id}","starred_url":"https://api.github.com/users/SanderSchutten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SanderSchutten/subscriptions","organizations_url":"https://api.github.com/users/SanderSchutten/orgs","repos_url":"https://api.github.com/users/SanderSchutten/repos","events_url":"https://api.github.com/users/SanderSchutten/events{/privacy}","received_events_url":"https://api.github.com/users/SanderSchutten/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-22T19:30:20Z","updated_at":"2015-04-22T19:30:20Z","closed_at":null,"body":"Hi,\r\n\r\nI've been working with Glass and Sitecore for a few weeks now, and love the way it helps boosting productivity.\r\n\r\nToday i've started using ItemRendering to render child items. In the view i've placed:\r\n@foreach (var articleItem in Model.DataItem.Items)\r\n{\r\n        @Html.Sitecore().ItemRendering(articleItem.Id.ToString());\r\n}\r\n\r\nIn the controller i've put the following code to get the RendererItem and bind it to the view:\r\npublic ActionResult Intro()\r\n{\r\n            var viewModel = new ArticleIntroViewModel(GetRendererItem<Article_Intro>());\r\n            return PartialView(\"~/Views/Modules/Article/Parts/text/intro.cshtml\", viewModel);\r\n}\r\n\r\nThe implementation of GetRendererItem is:\r\npublic virtual T GetRendererItem<T>() where T : class\r\n{\r\n                try\r\n                {\r\n                    return SitecoreContext.GetItem<T>(RenderingContext.Current.Rendering.Item.ID.Guid);                    \r\n                }\r\n                catch (InvalidOperationException)\r\n                {\r\n                    throw;\r\n                }\r\n}\r\n\r\nIs there a way to drop the custom implementation of GetRendererItem and use a OOTB Glass implementation?\r\n\r\nthanks in advance,\r\nSander Schutten"}}