简体   繁体   中英

Jquery datetimepicker() in ajax tabcontainer

I am having Ajax tab Container in my asp.net page. I am using jquery to select date by clicking in the textbox. But jquery is not working in the Ajax tab container.

below is the code that i am using.

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script type="text/javascript">
               $(document).ready(function () {
            $(".datecontrol").datepicker();
        });

    </script>
 </script>
</head>
<body>
    <form id="form1" runat="server">
    <ajax:ToolkitScriptManager ID="scriptmanager1" runat="server">
    </ajax:ToolkitScriptManager>
    <div class="Wrapper">
        <ajax:TabContainer ID="TabContainer1" runat="server" CssClass="fancy fancy-green"
            ActiveTabIndex="0">
            <ajax:TabPanel ID="tbpnluser" runat="server">
                <HeaderTemplate>
                    New Patient</HeaderTemplate>
                <ContentTemplate>
                    <asp:Panel ID="UserReg" runat="server">
<asp:TextBox ID="txtDob" runat="server" CssClass="datecontrol"></asp:TextBox>
 </asp:Panel>
                </ContentTemplate>
            </ajax:TabPanel>
 </ajax:TabContainer>
 </div>
    </form>
</body>
</html>

jQuery is not working because you didn't include jQuery library on your HTML page .

Include the latest jquery library from here:

http://jquery.com/

see here you need to import the following files.You only included css file not js file.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>

you have not included the id of the textbox in the script..Do this..

$(document).ready(function () {
        $("#txtDob").datepicker();
    });

Also u should include jquery as shown below..

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>

for more information see this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM