My code:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:GridView runat="server" ID="MyGridView" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Col1" HeaderText="Column 1" />
<asp:BoundField DataField="Col2" HeaderText="Date 1" />
<asp:BoundField DataField="Col3" HeaderText="Date 2" />
<asp:TemplateField HeaderText="Date 2" >
<EditItemTemplate>
<asp:TextBox ID="txtDate" CssClass="datepickerCompleted"
runat="server" Text="2011/1/1" ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Col4" HeaderText="Date 3" />
<asp:TemplateField HeaderText="Date 3"></asp:TemplateField>
</Columns>
</asp:GridView>
<script type="text/javascript" language="javascript" src="<%= VirtualPathUtility.ToAbsolute("~/Script/jquery-1.4.1-vsdoc.js")%>"></script>
<script type="text/javascript">
$(function () {
$(".datepickerCompleted").datepicker();
});
</script>
</asp:Content>
Followed example from here: enter link description here
When I look at the source, i do not see any value populate in txtDate text box, which i suspect is then not firing the jquery method..
how do i debug?
Based on the active/voted Answer, I think one more statement shall be added for better visibility of the datepicker. Otherwise it would be blurred/dimmed by the background. The proposed statement is put at 2nd line (assuming jquery-ui-1.8.14.custom.css file is downloaded & put in Css folder):
Your code looks good, but the
datepicker
is part of jQuery UI which is a separate download/script--it's not included in the jquery-1.4.1 file, and it looks like that's the only script you have referenced.EDIT: Here's an example that works for me:
You can download a copy of jQuery UI here, and here's some more information on the
datapicker
.