Search code examples
c#asp.net-mvcdatepickerbootstrap-datepicker

Trying to implement bootstrap datepicker to my ASP.NET MVC website


I have the following calls in my View that should let me open the Calendar and select a date, I'm not sure I understand how to implement Datepicker.

<script>
    $(document).ready(function () {
        $(".datepicker").datepicker();
    });
</script>

 <li class="input-group-addon">
       <label><%= CRAWebSiteMVC.Properties.Resources.EndDate %> :</label>                
       <input type="text" class="datepicker" placeholder="Click me!">
 </li>

I have installed bootstrap datepicker on the NuGet, what am I missing or not understanding?


Solution

  • this is how you implement bootstrap datepicker in html page link

      <div class="container">
        <div class="row">
            <div class='col-sm-6'>
                <div class="form-group">
                    <div class='input-group date' id='datetimepicker1'>
                        <input type='text' class="form-control" />
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                    </div>
                </div>
            </div>
            <script type="text/javascript">
                $(function () {
                    $('#datetimepicker1').datetimepicker();
                });
            </script>
        </div>
    </div>
    

    how to test if bootstrap 3 is loaded or not link

    // Will be true if bootstrap 3 is loaded, false if bootstrap 2 or no bootstrap
    var bootstrap3_enabled = (typeof $().emulateTransitionEnd == 'function');