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
I have the following razor code on a .cshtml page in WebMatrix which works fine. How do I accomplish the same results using Umbraco?
@{ var db = Database.Open("listings"); var selectQueryString = "SELECT * FROM ads WHERE (Category = N'Rentals') ORDER BY PositionSort ASC"; } @foreach(var row in db.Query(selectQueryString)){ <div itemscope itemtype="http://schema.org/LodgingBusiness" class="walk-listing"> <div class="photo"> <a href="@row.URL" rel="nofollow" target="_blank"><img src="@row.Photo_1" alt="@row.title" title="@row.title" /></a> </div> <div class="summary"> <h2><a href="@row.URL" itemprop="name" rel="nofollow" target="_blank">@row.Title</a></h2> <div class="walk-meta"> <span class="location"><i class="icon-map-marker"></i> <strong>City/State - </strong>@row.City, @row.State</span><br /> <span class="location"><i class="icon-map-marker"></i> <strong>County/Region - </strong>@row.County, @row.Region</span><br /> <span class="priceRange"><i class="icon-map-marker"></i> <strong>Rates - </strong>@row.Rates</span><br /> <span><i class="icon-map-marker"></i> <strong>Pet Friendly - </strong>@row.Pets</span> </div> <div itemprop="description" class="walk-summary"><strong>Description - </strong>@row.SDescription</div> <div itemprop="url" class="walk-meta-options"><i class="icon-heart"></i> <a href="@row.URL" rel="nofollow" target="_blank">Visit Website</a></div> </div> </div> }
Hi William and welcome to our.
What you could do is create a custom table in the Umbraco database, then store the information there and use this in your Umbraco installation.
Aptitude has made a video http://www.aptitude.co.uk/videos/using-custom-tables-data-in-umbraco/ on how you could do it, maybe it would benefit to see the video and after that try do something similar.
Hope this helps and could be a solution for you,
/Dennis
This topic might also help: http://our.umbraco.org/forum/developers/api-questions/49406-Get-data-from-custom-table-into-view,-using-petapoco-
Jeroen
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How do I display data from my SQL CE database using Razor syntax
I have the following razor code on a .cshtml page in WebMatrix which works fine. How do I accomplish the same results using Umbraco?
Hi William and welcome to our.
What you could do is create a custom table in the Umbraco database, then store the information there and use this in your Umbraco installation.
Aptitude has made a video http://www.aptitude.co.uk/videos/using-custom-tables-data-in-umbraco/ on how you could do it, maybe it would benefit to see the video and after that try do something similar.
Hope this helps and could be a solution for you,
/Dennis
This topic might also help: http://our.umbraco.org/forum/developers/api-questions/49406-Get-data-from-custom-table-into-view,-using-petapoco-
Jeroen
is working on a reply...