I have a site written in Umbraco 4.7 which I am rewriting in 7.2.1 to make it more mobile friendly. I'm new to MVC and to grid layout.
I have a custom DB table which contains text strings. In 4.7 I used an xslt extension and an xslt macro to retrieve and display the appropriate string. I now want to retrieve a string and display it in a layout grid cell on the front page. It seems the way to do this would be to write a partial view macro and include it in the front page grid layout. (I have some other partial view macros which access standard Umbraco published content and they work fine.)
What should the custom controller inherit from?
publicclasscustomStringController : <????>
How do I access that controller from the .cshtml partial view macro file?
Do I need to write a model or can I just access the DB from the controller? (The strings are not changed or updated from the web site, just displayed.)
Is there an example somewhere where this has already been answered?
Partial view macro for a custom data table
I have a site written in Umbraco 4.7 which I am rewriting in 7.2.1 to make it more mobile friendly. I'm new to MVC and to grid layout.
I have a custom DB table which contains text strings. In 4.7 I used an xslt extension and an xslt macro to retrieve and display the appropriate string. I now want to retrieve a string and display it in a layout grid cell on the front page. It seems the way to do this would be to write a partial view macro and include it in the front page grid layout. (I have some other partial view macros which access standard Umbraco published content and they work fine.)
What should the custom controller inherit from?
public class customStringController : <????>
How do I access that controller from the .cshtml partial view macro file?
@inherits Umbraco.Web.Macros.PartialViewMacroPage<???>
Do I need to write a model or can I just access the DB from the controller? (The strings are not changed or updated from the web site, just displayed.)
Is there an example somewhere where this has already been answered?
Thanks - Jon
Hi Jon and welcome to our,
Perhaps this video http://www.aptitude.co.uk/videos/using-custom-tables-data-in-umbraco/ from Aptitude can help you how to make a Partial view macro for a custom data table and try to see this topic as well. http://our.umbraco.org/forum/developers/api-questions/49406-Get-data-from-custom-table-into-view,-using-petapoco-
Hope this helps,
/Dennis
Thank you - I'll look at them.
is working on a reply...