Maybe it will be a silly question but I couldn't handle my problem. I checked all the questions and answers on here but I didn't find any clue. Anyway, I want to use the bootstrap datepicker with asp.net textbox. When I use it with input without the runat="server" tag, I see that the datepicker shows up, but when I try to use it with textbox with the runat="server" tag, the datepicker is not showing. Any idea on how to solve this issue?
<asp:TextBox ID="DateTextbox" runat="server" CssClass="m-wrap span12 date form_datetime"></asp:TextBox>
<script type="text/javascript">
$(document).ready(function () {
var dp = $("#<%=DateTextbox.ClientID%>");
dp.datepicker({
changeMonth: true,
changeYear: true,
format: "dd.mm.yyyy",
language: "tr"
});
});
</script>
Thanks for your answers.
thanks for your answers. i did a lil change on my code its working now. i am posting for further use.
<script type="text/javascript">
$(document).ready(function () {
var dp = $('#<%=DateTextbox.ClientID%>');
dp.datepicker({
changeMonth: true,
changeYear: true,
format: "dd.mm.yyyy",
language: "tr"
}).on('changeDate', function (ev) {
$(this).blur();
$(this).datepicker('hide');
});
});
</script>
but i dont understand whats make the diffrence between (") and (') ?
Try this
<asp:TextBox ID="DateTextbox" ClientIDMode="Static" runat="server" CssClass="m-wrap span12 date form_datetime"></asp:TextBox>
<script type="text/javascript">
$(document).ready(function () {
var dp = $("#DateTextbox");
dp.datepicker({
changeMonth: true,
changeYear: true,
format: "dd.mm.yyyy",
language: "tr"
});
});
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With