Articles in this section
Category / Section

How to render ASP.NET MVC Schedule by enabling unobtrusive JavaScript?

3 mins read

The following steps help you to add the ASP.NET MVC Scheduler control into the MVC application with UnobtrusiveJavaScriptEnabled property set to true in the web.config file. Refer here to Create/Add the EJMVC Schedule in MVC application.

  1. Now, enable the UnobtrusiveJavaScriptEnabled key in the web.config page by setting it to true as follows,

web.config

  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  1. When the UnobtrusiveJavaScriptEnabled key is set to true, the ScriptManager rendering code added in the Layout.cshtml page is not required. Therefore, comment or remove the ScriptManager code from the application as follows.

Layout.cshtml

@*@Html.EJ().ScriptManager()*@
  1. Add and refer to the script file ej.unobtrusive.min.js in the Layout.cshtml page as illustrated in the following code example.

Layout.cshtml

<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Content/ej/default-theme/ej.widgets.all.min.css")" rel="stylesheet" />
    <script src="@Url.Content("~/Scripts/jquery-2.1.4.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jsrender.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.easing-1.3.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.globalize.min.js")"></script>
    <script src="@Url.Content("~/Scripts/ej/ej.web.all.min.js")"></script>      
    <script src="@Url.Content("~/Scripts/ej/ej.unobtrusive.min.js")"></script>
  1. Execute the sample and the Schedule control is displayed as follows.

Schedule control in ASP.NET MVC

Figure 1: Schedule control

Sample link:

https://s3.amazonaws.com/files2.syncfusion.com/dtsupport/directtrac/131776/ze/ScheduleSampleUnobtrusive-1950530286.zip?AWSAccessKeyId=AKIAWH6GYCX3YH6S4NTZ&Expires=1691402880&Signature=AmYIzKtyKCj%2BsAUAnSNxjL9Wq%2FE%3D

Conclusion

I hope you enjoyed learning about how to render the Schedule control by enabling UnobtrusiveJavaScriptEnabled in ASP.NET MVC.

You can refer to our ASP.NET MVC Schedule feature tour page to know about its other groundbreaking feature representations documentation and how to quickly get started for configuration specifications.  You can also explore our ASP.NET MVC Schedule example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (1)
Please  to leave a comment
BT
Bill Thomasson
You should add this to the Getting Started MVC guide.
KK
Karthigeyan Krishnamurthi

Hi Bill,

 

Please check the following link where we have already included that information in UG documentation under the common core topics.

https://help.syncfusion.com/aspnetmvc/unobtrusive

 

 

Regards,

Karthigeyan

 

Access denied
Access denied