We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Can't get Mobile Project / Grid Control working

Hello,

I'm new to Syncfusion and I'm trying to get the mobile ASP.NET MVC controls working for my new project I have to make.
In my test project with web controls everything went fine, but in my mobile project I cant get the controls working.

I referenced the .dlls, added them to my 2 Web.configs and to my BundleConfig. The Intellisense in VS is working fine, it shows me EJ().
But the ej.mobile.all.min.js (in _Layout.cshtml) destroys my layout and in the grid page (/grid/index) the grid just shows the header names.

I've attached my project in a zip to this thread, maybe someone is kind enough to have a look at it, whats wrong?
The sample project is working fine, I don't know the differences, I tried to build it just like the sample project but it didn't work.

Thanks  in advance and and best regards
Michi

Attachment: Mobile_89c657f5.zip

3 Replies

BM Balaji Marimuthu Syncfusion Team September 8, 2015 09:32 AM UTC

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>&copy; @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




MI Michi September 8, 2015 10:12 AM UTC

Hi Balaji,

you are awesome! Thank you so much, it's hard to get started, I had things like jsrender included, but it didn't work so I changed things again and again.
But now it's working fine!

Thanks again, have a nice day :-)
Regards,
Michi




BM Balaji Marimuthu Syncfusion Team September 9, 2015 04:41 AM UTC

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


Loader.
Up arrow icon