Getting jQuery datepicker to attach to a TextBox within a ListView
Posted
by Clay
on Stack Overflow
See other posts from Stack Overflow
or by Clay
Published on 2010-06-16T21:16:31Z
Indexed on
2010/06/16
21:22 UTC
Read the original article
Hit count: 289
I am using the jQuery Datepicker without any problem for TextBox controls that are non-templated. However, I am unable to get the datepicker to work with a TextBox that is in an EditItemTemplate of a ListView control. My latest attempt is to get a handle on this textbox by CSS class name "DateControl", any ideas?
<asp:ListVIew id="lvTest" runat="server">
<LayoutTemplate>...</LayoutTemplate>
<ItemTemplate>...</ItemTemplate>
<EditItemTemplate>
<tr>
<td>
<asp:TextBox ID="txtExpReceiveDate" runat="server" Text='<%#Eval("exp_receive_date","{0:dd-MMM-yy}") %>' CssClass="DateControl" />
</td>
</tr>
</EditTemplate>
</asp:ListView>
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$('DateControl').datepick({ dateFormat: 'M-dd-yyyy' });
});
</script>
© Stack Overflow or respective owner