Jquery date time picker not working
I used the jQuery date time picker with a button image. It's not showing and not working....
This is ascx.cs file:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ExclusionSwipeCardRequest.ascx.cs" Inherits="ExclusionSwipeCardRequest" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<link href="../App_Themes/LMSTheme/Style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../Scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(function() {
$( "#<%=txtFromDate.ClientID%>" ).datepicker({
showOn: "button",
buttonImage: "Images/clock_add.png",
buttonImageOnly: true
});
});
</script>
Textbox:
<td>
<asp:TextBox ID="txtFromDate" MaxLength="10" runat="server" ToolTip="Enter From Date"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVIssueDate" runat="server" ControlToValidate="txtFromDate" ErrorMessage="*" ValidationGroup="Enter">
&l开发者_JS百科t;/asp:RequiredFieldValidator>
</td>
Well why do you use echo for the ID?
And you are trying to use the jQuery UI (NOT jquery) DatePicker, so you should include their library :) (http://jqueryui.com/download) See http://jqueryui.com/demos/datepicker/ for more info.
Is DateTimePicker part of Jquery ui, then you have to include jquery ui!
Edit: Oh sorry same answer :)
In addition to what Marco Johannesen said, make sure the ID or class of the TextBox is actually being selected by the jQuery selector. Usually, if you're using a MasterPage, this ID is modified concatenating the ContentPlaceHolder ID at the beginning of the ID. More info: How to use JQuery with Master Pages?
精彩评论