plutosteel
plutosteel

Reputation: 23

How to Get Datasource from sublayout using glassmapper

I know in MVC you could do this.GetLayoutItem<Model>() to get the datasource of rendering on a page. How do we make use of this in sublayouts (.ascx)?

Upvotes: 1

Views: 461

Answers (1)

Wesley Lomax
Wesley Lomax

Reputation: 2077

If you inherit your user control from the GlassUserControl the AbstractGlassUserControl has properties for LayoutItem which will give you the datasource if its defined or there is a DataSourceItem property which returns the datasource explicitly.

Using GlassUserControl

Upvotes: 1

Related Questions