Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Best Practice to Add a Slider Option in ASP.Net Core Web Application

$
0
0

I am creating a simple web application using ASP.Net Core 2.0 in Visual Studio 2017 with razor pages.  I am looking to add a simple slider control to the MVC Views when editing my data model.  I am not sure what is the best technology moving forward to use to create a simple slider.

In my project I thought it would be easy to add JQuery-UI and add script code to create the slider but I am unable to get the slider visible on the razor page.  I installed the latest version of jquery-ui using Bower and I can see all of the files in the lib folder.  There is a ui/widget folder and I can see the slider.js folder.  I tried modifying the _layout.cshtml by adding :

        <link rel="stylesheet" href="~/lib/jquery-ui/themes/base/all.css" />

to the development environment and I added several script folders also in the _layout.cshtml  enviroment:

       <script src="~/lib/jquery-ui/ui/core.js"></script>
        <script src="~/lib/jquery-ui/ui/widget.js"></script>
        <script src="~/lib/jquery-ui/ui/widgets/slider.js"></script>

In the edit.csthml. View I added the following code just to see if it would work:

<div id="slider"></div>

<h4>Slider</h4>

<script>
  $( function() {
    $( "#slider" ).slider();
  } );
</script>

I am not  just looking for a quick fix but I am also looking for advice in the best way to work with scripts in ASP.Net Core.  I see a lot of comments about angular and grunt and I am not sure if I should be incorporating these into a production web application.  I appreciate any recommendation you might have for someone still learning form converting a windows application into a web application.  Thank you.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>