Hi Michi,
In the provided sample, the scripts are referred after RenderBody is initialized. Since scripts are required to render the EJ controls, we suggest you to refer to the scripts before calling the RenderBody.
Please refer to the below code example,
@Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/jqueryeas") @Scripts.Render("~/bundles/cultures") @Scripts.Render("~/bundles/jqueryval") @Scripts.Render("~/bundles/bootstrap") @Scripts.Render("~/bundles/ej")
<script> App.renderEJMControlsByDef = false; </script>
<div class="container body-content" style="margin-top:100px"> @RenderBody() <hr /> <footer> <p>© @DateTime.Now.Year - Meine ASP.NET-Anwendung</p> </footer> </div> @RenderSection("scripts", required: false) |
jsRender helps to render the templates. So, include the jsrender.min.js file in your project.
bundles.Add(new ScriptBundle("~/bundles/ej").Include( "~/Scripts/jsrender.min.js", "~/Scripts/ej.mobile.all.min.js"));
|
Specify the CSS also with full name instead of specifying *. Please refer to the below code example,
bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.css", "~/Content/site.css", "~/Content/EJ/ej.mobile.all.min.css")); |
If you use only the Mobile controls in your project, then no need to refer the ej.widget.core.min file. It has to be referred only when we add the web controls.
Query: But the ej.mobile.all.min.js (in _Layout.cshtml) destroys my layout
In Mobile JS core, elements like Input, Button, Anchor tag that doesn’t contain data-role attribute are initiated specifically. Therefore, whenever the Mobile source file is referred in the sample, Input, Button, Anchor tag elements (without data-role attribute) are rendered as respective Mobile JS controls automatically.
However, an option is provided to prevent this auto initialization. To prevent default rendering of Mobile JS controls, set App.renderEJMControlsByDef property as false with the script section as in the following code example.
We have modified your sample and the same can be downloadable from the following link:
Sample: Mobile
<script> App.renderEJMControlsByDef = false; </script> |
Regards,
Balaji Marimuthu
Hi Michi,
We are happy that the provided suggestion helped you.
Please get back to us if you need any further assistance.
Regards,
Balaji Marimuthu