1

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">
     </asp:RequiredFieldValidator>
</td>
Ashish
  • 2,544
  • 6
  • 37
  • 53
Kajah User
  • 593
  • 5
  • 17
  • 56

3 Answers3

0

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.

Marco Johannesen
  • 13,084
  • 6
  • 31
  • 36
0

Is DateTimePicker part of Jquery ui, then you have to include jquery ui!

Edit: Oh sorry same answer :)

MarkoHiel
  • 15,481
  • 2
  • 21
  • 29
0

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?

Community
  • 1
  • 1
aleafonso
  • 2,244
  • 8
  • 38
  • 58