Skip to content Skip to sidebar Skip to footer

Asp.net With Jquery Datepicker

I would like to do something like this: http://jqueryui.com/datepicker/ However, I'm not exactly sure how: I have a masterpage-content page, and when I tried to copy that code and

Solution 1:

You need to use the runat="server" like this in your html:

<inputtype="text"id="datepicker" runat="server">

Then on your server side your can refer to datepicker as a server object and access datepicker.Value.

To @C.J comment. This is the source code included on this link added on the question, it is there where the runat=server goes:

This goes on your Master Page:

<scriptsrc="//code.jquery.com/jquery-1.10.2.js"></script><scriptsrc="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script><linkhref="/resources/demos/style.css">

This goes on your Content Page:

<p>Date: <inputtype="text"id="datepicker"class="datepicker"></p><script>
  $(document).on('ready',function() {
    $( ".datepicker" ).datepicker();
  });
</script>

Solution 2:

HTML5 use type="date"

<asp:TextBox ID="tbDate" runat="server"type="date"></asp:TextBox>

Solution 3:

You need to initialize your datepicker and add runat="server" to your input like this:

$(function() {
   $("#datepicker").datepicker();
});


<inputtype="text"id="datepicker"runtat="server">

Post a Comment for "Asp.net With Jquery Datepicker"