c# - Datetimepicker does only work with Input field, not Asp:TextBox -
my bootstrap datetimepicker work input tag this:
<input type="text" class="form-control" id="datetimepicker1" /> <input type="text" class="form-control" id="datetimepicker2" />
is possible convert asp:textbox, because need use control when operating database. right got:
<div class="form-group"> <asp:label id="checkinlabel" runat="server" text="check- in date"></asp:label> <asp:textbox id="datetimepicker1" runat="server" cssclass="form-control"></asp:textbox> </div> <div class="form-group"> <asp:label id="checkoutlabel" runat="server" text="check-out date"></asp:label> <asp:textbox id="datetimepicker2" runat="server" cssclass="form-control"></asp:textbox> </div>
script:
$(function () { $("#datetimepicker1").datetimepicker({ format: 'dd/mm/yyyy', }); $("#datetimepicker2").datetimepicker({ format: 'dd/mm/yyyy', }); $("#datetimepicker1").on("dp.change", function (e) { $('#datetimepicker2').data("datetimepicker").mindate(e.date); }); $("#datetimepicker2").on("dp.change", function (e) { $('#datetimepicker1').data("datetimepicker").maxdate(e.date); }); }); </script>
i'm asking because when using input , put runat="server" on , errors because of controlid.
use clientidmode="static"
attribute or in web.config. keep ids changing.
you have 3 options:
1.) control attribute
2.) page level setting
3.) attribute on pages
element in web.config
Comments
Post a Comment