I have two apps. One of them is web app and the other one is mobile app. I am trying to parse one of the views from the web app and compile a html file for the mobile app. The structure of my view in web app is as follows
The web app is built in asp.net mvc and I am using Microsoft visual studio cordova to built the mobile apps.
I have a separate project, which takes the App.cshtml and compile index.html for mobile app. Here is the structure of my App.cshtml file
@model Account
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = Texts.App;
}
@section head{
@Styles.Render("~/Content/css/app")
}
@section scripts {
@Scripts.Render("~/bundles/moment")
@Scripts.Render("~/bundles/tippnett/app")
<script>
var userId = '@Model.Id';
TippNett.StartApp();
</script>
}
<div id="appview" class="loading">
<div id="workspace" class="map_canvas">
<section class="other-stuff">
@RenderPage("~/Views/Home/subPagesForApp/_locationWindow.cshtml")
@RenderPage("~/Views/Home/subPagesForApp/_moveLocationWindow.cshtml")
@RenderPage("~/Views/Home/subPagesForApp/_orderWindow.cshtml")
@RenderPage("~/Views/Home/subPagesForApp/_createLocation.cshtml")
@RenderPage("~/Views/Home/subPagesForApp/_ordersListWindow.cshtml")
@RenderPage("~/Views/Home/subPagesForApp/_reportAbuse.cshtml")
</section>
</div>
<div class="locations-list" data-bind="visible:locationView">
@RenderPage("~/Views/Home/subPagesForApp/_locationList.cshtml")
</div>
<div id="loading-wale">
<div id="loading-info">
<div>
<i class="spinner"> </i>
</div>
<div>@Texts.Loading</div>
</div>
</div>
</div>
<div class="show-for-small" id="stick-menu" data-role="footer">
<div class="icon-bar three-up ">
<a class="item active locations" data-bind="click: openLocationView.bind($data,true)">
<i class="fi-marker"></i>
<label>@Texts.Location</label>
</a>
<a class="item maps" data-bind="click: openMapView.bind($data,true)">
<i class="fi-map"></i>
<label>@Texts.Maps</label>
</a>
<a class="item notifications" data-bind="click: openOrders.bind($data,true)">
<i class="fi-list"></i>
<span class="order-notification-counter notification-counter" data-bind=" text: orders().length,visible: orders().length > 0"></span>
<span class="matches-notification-counter notification-counter" data-bind=" text: matches().length,visible: matches().length > 0"></span>
<label>
@Texts.OrdersLabel
</label>
</a>
</div>
I have looked into RazorEngine.Razor.Compile, but no luck. I have also looked into this library as well http://razorengine.codeplex.com/, but couldn't get anywhere.
cshtml is run server side,cordova app run in mobile(client)
so i think you can't run mvc on mobile,you should use some mobile framework
html as template,js call ajax get data,and bind to html template.