简体   繁体   English

HTML5范围滑块的最小值和最大值

[英]HTML5 Range Slider Min and Max Values

I have an HTML5 slider within an ASP.NET MVC 5 application: 我在ASP.NET MVC 5应用程序中有一个HTML5滑块:

<input type="range" name="rangeInput" min="0.00" max="100" value="0" step="5">

How can I get the max value from an Microsoft SQL Server table? 如何从Microsoft SQL Server表中获取最大值?

Do I need to use Jquery/Ajax for this to access a controller action to then get the value from the database? 我是否需要为此使用Jquery / Ajax来访问控制器操作,然后从数据库中获取值?

I have looked on the internet for answers but have had no luck so far. 我在互联网上寻找答案,但是到目前为止还没有运气。

You already have specified the Max value in the declaration of the slider. 您已经在滑块的声明中指定了最大值。

If you mean how you can get the value of the slider from the database then, you need to query from the server side and set the value returned using jquery's val method in the Ajax call of get type. 如果您是说如何从数据库中获取滑块的值,则需要从服务器端进行查询,并在get类型的Ajax调用中设置使用jquery的val方法返回的值。

Usually you don't access the database directly from the View (your HTML page), that is against the principle of the MVC architecture. 通常,您不直接从View(您的HTML页面)访问数据库,这违反了MVC体系结构的原则。

Besides the MVC architecture you can use other tiers, and use an ORM like Entity Framework to access the Database. 除了MVC体系结构,您还可以使用其他层,并使用诸如实体框架之类的ORM来访问数据库。

Please check the link for more information: http://www.codeproject.com/Articles/70061/Architecture-Guide-ASP-NET-MVC-Framework-N-tier-En 请检查链接以获取更多信息: http : //www.codeproject.com/Articles/70061/Architecture-Guide-ASP-NET-MVC-Framework-N-tier-En

To learn ASP.Net MVC I would recommend you to read the book from Dino Esposito (Programming Microsoft ASP.NET MVC), get the latest edition. 要学习ASP.Net MVC,我建议您阅读Dino Esposito(编程Microsoft ASP.NET MVC)中的书,获取最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM