How to set a date/ get a date for Datepicker in codebehind
11,791
Solution 1
<input id="datepicker0" type="text" name="datepickernm"/>
You can get the value from below code in the codebehind:
String text = Page.Request.Form["datepickernm"]
Solution 2
Use an ASP textbox control:
<asp:textbox runat="server" id="txtDate"/>
<script type="text/javascript">
$('#<%= txtDate.ClientID %>').datepicker();
</script>
This way you could get and set the value from code behind.
Related videos on Youtube
Author by
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
I can't manage to set a date and to get a date of Datepicker in code behind(C#) does anyone have informations to give me about this ? thanks in advance!
<input id="datepicker" value="01/01/2011" type="text"/> $(document).ready(function () { $("#datepicker").datepicker(); });
-
Admin about 12 yearsso this should work to get date in code behind but to set a date ? thank you for your help
-
EaziLuizi about 10 yearsThe best solution for complete functionality.. thank you