0

My problem is that the calender doesn't show properly (not using googles css) Here is my code:

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
     <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>      
     <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css">   
     <script src="http://code.jquery.com/jquery-1.9.1.js"></script>    
     <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
     <script>
         $(function () {
             $("#MainContent_startDate").datepicker();
             $("#MainContent_endDate").datepicker();
         });
     </script>
</asp:Content>


<asp:TextBox ID="startDate" CssClass="InfoData" runat="server" TextMode="Date" Visible="false"></asp:TextBox>

<asp:TextBox ID="endDate" CssClass="InfoData" runat="server" TextMode="Date" Visible="false"></asp:TextBox>

I have tried using IE, FF and Chrome. In IE it says at the bottom: "Only safe content is shown". If I then click "Show all content", then the datepicker shows properly with googles css. But in FF and Chrome I don't get this possibility. But I don't think that it should ask this at all, it should just show the datepicker with the right css, as shown on the jquery example. Any idea? I saw a many topics with this issue, but not exactly the same as mine

Thanks in advance

enter image description here

4
  • Please, replace your asp.net code by browser's html code. Commented Sep 4, 2013 at 12:08
  • 1
    You are using multiple versions of jquery together? Commented Sep 4, 2013 at 12:11
  • 1
    @QuickSilver I think it is not an issue, check this jsfiddle jsfiddle.net/EZdNe Commented Sep 4, 2013 at 12:15
  • 1
    you're jquery selectors don't match the id's of your inputs Commented Sep 4, 2013 at 12:21

2 Answers 2

2

In your TextBox control add ClientIDMode="Static" to match the ID selector like

    <asp:TextBox ID="endDate" ClientIDMode="Static" runat="server" />

Then keep this header only and datetimepicker should work

    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script type="text/javascript">
          $(document).ready(function () {
             $("#startDate").datepicker();
             $("#endDate").datepicker();
         });
    </script>
Sign up to request clarification or add additional context in comments.

Comments

0

You're referring wrong selector(ID mismatch)

  $(function () {
                 $("#startDate").datepicker();
                 $("#endDate").datepicker();
             });

check this http://jsfiddle.net/EZdNe/1/

Also why are having 2 different css files?

 <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />   
 <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css">   

This may lead to CSS Conflict.

3 Comments

Hi. Thanks for the respond. The IDs should work, those aren't then right IDs, I just added them here on stackoverflow. The date does show according to the ID, it just doesn't use the css from google. About using 2 css files. I just forgot to remove the 2nd one, it was from a desparate attemt, when I had no more options
I have added a screenshot so that you can see the issue. You can see it on top with my first post.
This seems to be css conflict. Better check with other stylesheets whether any style is getting override.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.