I am having a jquery function for datetime picker and i have called that function in master page header and when i am giving datetime values in child page datetimepicker is loading only once when form is loading newly after i am pressing submit button
datetimepicker is not functioning second time what is the reason
Mymasterpage code is :
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="NewMaster.master.cs" Inherits="NewMaster" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>CMS</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="icon" type="image/gif" href="animated_favicon1.gif" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="gridview.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="styles/style.css" media="screen" />
<link href="styles/styles_masterpage.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="scripts/Validation.js"></script>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<style type="text/css">
body, html
{
overflow-x: hidden;
}
.style1
{
width: 374px;
}
</style>
</head>
<script type="text/JavaScript">
</script>
<body>
<form id="form1" runat="server">
<div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" width="100%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3">
<img src="images/header_strip.jpg" alt="" style="height: 0px; width: 100%" />
</td>
</tr>
<tr>
<td class="top_bg">
<div align="left">
<a href="">
<img name="top" hspace="8" border="0" id="top" src="images/Buttons/logo.jpg" />
</a>
</div>
</td>
<td align="center">
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/c1.gif" />
</td>
<td class="vv_bg">
<div align="right">
<a href="">
<img name="justclick" hspace="8" border="0" id="Img1" src="images/justclick.png" />
</a>
</div>
</td>
<td valign="middle" class="top_bg">
</td>
</tr>
<tr>
<td align="right" colspan="2">
<table>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" width="100%" colspan="2">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="nav_bg" style="background-color: #5C6A84">
<tr>
<td align="right">
<table>
<tr>
<td>
<asp:Label ID="Label2" runat="server" BorderColor="#7A2784" Font-Bold="True" Font-Italic="False"
Font-Names="Times New Roman" Font-Size="Larger" ForeColor="#FFFFFF" Width="179px"
Style="margin-left: 0px"> Welcome To CMS :<%= Session["username"]%> </asp:Label>
</td>
<td>
<asp:LinkButton ID="LinkButton2" runat="server" Font-Bold="True" OnClick="LinkButton1_Click"
Style="color: #FFFFFF;">SignOut</asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" width="13%" class="menualign" valign="top">
<%--<table width="100%">
<tr>
<td>--%>
<asp:Menu ID="menuSlide" runat="server" DataSourceID="XmlDataSource1" Orientation="Vertical"
BackColor="Silver" align="left" Font-Size="Medium" Width="100%" StaticMenuItemStyle-HorizontalPadding="5px"
OnMenuItemClick="menuSlide_MenuItemClick">
<DataBindings>
<asp:MenuItemBinding DataMember="MenuItem" NavigateUrlField="NavigateUrl" TextField="Text"
ToolTipField="ToolTip" />
</DataBindings>
<StaticMenuItemStyle ItemSpacing="8" CssClass="staticMenuItemStyle" />
<StaticSelectedStyle CssClass="staticMenuItemSelectedStyle" />
<DynamicMenuItemStyle CssClass="dynamicMenuItemStyle" />
</asp:Menu>
<%--</td>
</tr>
</table>--%>
</td>
<td align="left" width="87%" valign="top">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td height="35" bgcolor="#5C6A84" colspan="2" width="100%">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="style1" style="margin-left: 0px; color: #FFFFFF;">
Copyright © 2009 All Rights Reserved.
</td>
<td width="60%" class="White" style="padding-right: 0px;" align="right">
<div style="padding-right: 0px; color: #FFFFFF;">
Powered By: <a href="http://www.Veeserv.com" target="_blank" class="b" style="color: #FFFFFF;">
VeeServ Technologies Pvt.Ltd</a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" width="100%">
<asp:XmlDataSource ID="XmlDataSource1" TransformFile="~/Menu/TransformXSLT.xslt"
XPath="MenuItems/MenuItem" runat="server"></asp:XmlDataSource>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
And content page code is
<%@ Page Language="C#" MasterPageFile="~/NewMaster.master" AutoEventWireup="true" CodeFile="DAttd.aspx.cs" Inherits="DAttd" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server" >
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript">
$(document).ready(function() {
$("#<%=TextBox1.ClientID %>").datepicker();
});
</script>
<script language="javascript" type="text/javascript">
function ltrim(s)
{
return s.replace( /^\s*/, "");
}
function trim(s)
{
return s.replace(/^\s+|\s+$/g,"");
}
function Daily() {
var da= document.getElementById('<%=TextBox1.ClientID %>');
var ay = document.getElementById('<%=DropDownList2.ClientID %>');
var co = document.getElementById('<%=DropDownList3.ClientID %>');
var ty = document.getElementById('<%=DropDownList4.ClientID %>');
if(ltrim(da.value) == "")
{ da.style.background = 'Yellow'; alert("Please select the date of birth !"); da.focus(); return false; }
else
{ da.style.background = 'White'; }
if (ay.selectedIndex == 0)
{ ay.style.background = 'Yellow'; alert("Please select the Academic Year !"); ay.focus(); return false; }
else
{ ay.style.background = 'White'; }
if (co.selectedIndex == 0)
{ co.style.background = 'Yellow'; alert("Please select the Course !"); co.focus(); return false; }
else
{ co.style.background = 'White'; }
if (ty.selectedIndex == 0)
{ ty.style.background = 'Yellow'; alert("Please select the type !"); ty.focus(); return false; }
else
{ ty.style.background = 'White'; }
}
</script>
<asp:ScriptManager ID="scriptmanager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="updatepanel1" runat="server">
<ContentTemplate>
<div style="width: 100%;">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="95%" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="2" style="background-color: #ffffff">
<tr>
<td align="center">
<%----%>
<img src="images/Head/stfdaly.PNG" />
</td>
</tr>
<tr>
<td align="left" width="100%">
<table width="66%" align="center">
<tr>
<td align="left" width="24%">
<asp:Label ID="Label3" runat="server" CssClass="lbl" Text="Date"></asp:Label>
</td>
<td style="height: 6px" width="2%">
:
</td>
<td align="left" width="24%">
<%----%>
<asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="Disabled" CssClass="normal"
onblur="this.className='normal'" onfocus="this.className='focus'" Width="100px"></asp:TextBox>
<%----%>
</td>
<td align="left" width="24%">
<asp:Label ID="Label4" runat="server" CssClass="lbl" Text="Academic Year"></asp:Label>
</td>
<td style="height: 6px" width="2%">
:
</td>
<td align="left" width="24%">
<asp:DropDownList ID="DropDownList2" runat="server" Width="120px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="left" width="24%">
<asp:Label ID="Label5" runat="server" CssClass="lbl" Text="Department"></asp:Label>
</td>
<td style="height: 6px" width="2%">
:
</td>
<td align="left" width="24%">
<asp:DropDownList ID="DropDownList3" runat="server" Width="120px">
</asp:DropDownList>
</td>
<td align="left" width="24%">
<asp:Label ID="Label6" runat="server" CssClass="lbl" Text="Type"></asp:Label>
</td>
<td style="height: 6px" width="2%">
:
</td>
<td align="left" width="24%">
<asp:DropDownList ID="DropDownList4" runat="server" Width="120px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="center" width="100%" colspan="6">
<asp:Button ID="Button5" runat="server" CssClass="Fetch" OnClick="Button5_Click"
OnClientClick="return Daily()" />
</td>
</tr>
<tr>
<td align="right" width="50%" colspan="3">
<asp:CheckBox ID="CheckBox1" runat="server" Font-Bold="True" Text="Select All Morning"
AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" />
</td>
<td align="left" width="50%" colspan="3">
<asp:CheckBox ID="CheckBox2" runat="server" Font-Bold="True" Text="Select All Afternoon"
AutoPostBack="True" OnCheckedChanged="CheckBox2_CheckedChanged" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="100%"
GridLines="None" CssClass="mGrid" PagerStyle-CssClass="pgr" BorderStyle="None"
BorderWidth="1px" CellPadding="3" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging"
Font-Names="MS Sans Serif" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:BoundField HeaderText="Employee" DataField="EN">
<HeaderStyle Font-Size="8pt" />
</asp:BoundField>
<asp:TemplateField>
<HeaderTemplate>
Morning
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chk" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:DropDownList ID="ddl" runat="server" DataTextField="LNAME" DataValueField="LNAME"
AppendDataBoundItems="true">
</asp:DropDownList>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderTemplate>
Morning Leave
</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="cb" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderTemplate>
Afternoon
</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:DropDownList ID="ddl2" runat="server">
</asp:DropDownList>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderTemplate>
Afternoon Leave
</HeaderTemplate>
</asp:TemplateField>
</Columns>
<%----%>
</asp:GridView>
<asp:Label ID="Label2" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="Button1" runat="server" Style="display: none;" OnClick="Button1_Click" />
<asp:Button ID="Button3" runat="server" CssClass="Save" OnClick="Button3_Click" />
<asp:Button ID="Button4" runat="server" Style="display: none;" OnClick="Button4_Click" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>