The code below is a datetimepicker in which i just reference the name of the textbox then it work fine I want this to work for txtTestdate, txtResultDate, txtFromdate and txtToDate.
<script type="text/javascript">
$(document).ready(function () {
$('#<%=txtFromDate.ClientID%>').datepicker({
dateFormat: 'dd/mm/yy'
});
});
</script>
But i have a problem when the text box is inside a repeater control then the javascript code does not want to identify the conrol. Below is my repeater control.
<asp:Repeater ID="rpAllCovidHistory" runat="server">
<HeaderTemplate>
<table class="table table-striped table-bordered table-hover table-condensed" border="1">
<thead>
<tr>
<th id="CovidHistoryIDHead" runat="server" visible="false">No</th>
<th>Name</th>
<th>Captured Date</th>
<th>Clock No</th>
<th>Status</th>
<th>Test Result</th>
<th>Test Date</th>
<th>Result Date</th>
<th>Start Date</th>
<th>Return Date</th>
<th>Other</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr runat="server" id="employeeInfo">
<td id="lblCovidHistory" runat="server" visible="false">
<asp:Label Text='<%#DataBinder.Eval(Container.DataItem, "CovidHistoryID")%>' runat="server" ID="lblCovidHistoryID" />
</td>
<td>
<asp:Label Text='<%#DataBinder.Eval(Container.DataItem, "EmployeeName")%>' runat="server" ID="lblEmployeeName" />
</td>
<td>
<asp:Label Text='<%# Eval("CaptureDate", "{0: dd/MM/yyyy}")%>' runat="server" ID="Label1" />
</td>
<td>
<asp:Label Text='<%#DataBinder.Eval(Container.DataItem, "ClockNo")%>' runat="server" ID="lblClockNo" />
</td>
<td>
<asp:Label Text='<%#DataBinder.Eval(Container.DataItem, "Quarantine")%>' runat="server" ID="lblQuarantine" />
</td>
<td>
<asp:TextBox ID="txtTestResult" Visible="true" class="form-control" BorderStyle="None" BackColor="#F9F9F9" Enabled="false" Text='<%#DataBinder.Eval(Container.DataItem, "TestResult")%>' runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtTestDate" Visible="true" class="form-control" BorderStyle="None" BackColor="#F9F9F9" Enabled="false" Text='<%# Eval("TestDate", "{0: dd/MM/yyyy}")%>' runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtResultDate" Visible="true" class="form-control" BorderStyle="None" BackColor="#F9F9F9" Enabled="false" Text='<%# Eval("ResultDate", "{0: dd/MM/yyyy}")%>' runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtFromDate" Visible="true" class="form-control" BorderStyle="None" BackColor="#F9F9F9" Enabled="false" Text='<%# Eval("FromDate", "{0: dd/MM/yyyy}")%>' runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtToDate" Visible="true" class="form-control" BorderStyle="None" BackColor="#F9F9F9" Enabled="false" Text='<%# Eval("ToDate", "{0: dd/MM/yyyy}")%>' runat="server"></asp:TextBox>
</td>
<td>
<asp:Label Width="300px" Text='<%#DataBinder.Eval(Container.DataItem, "Other")%>' runat="server" ID="lblOther" />
</td>
<td>
<asp:LinkButton ID="lbtnEdit" CssClass="btn btn-sm btn-success" CommandName="Edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "CovidHistoryID") %>' OnClick="lbtnEdit_Click" runat="server">Edit</asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="lbtnSave" CssClass="btn btn-sm btn-success" Enabled="false" OnClick="lbtnSave_Click1" runat="server">Save</asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="lbtnCancel" CssClass="btn btn-sm btn-success" Enabled="false" OnClick="lbtnCancel_Click1" runat="server">Cancel</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</FooterTemplate>
</asp:Repeater>