Click here to Skip to main content
12,758,462 members (32,376 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET4
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" %>






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)
{
    //s=s.replace(/^\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">
                                            <%--<asp:Label ID="Label2" runat="server" Style="font-size: 14pt; color: #2B6799; font-family: Verdana">
                                                      College Details</asp:Label>--%>
                                            <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%">
                                                        <%--<a href="javascript: NewCal('TextBox1','MMDDYYYY');">--%>
                                                            <asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="Disabled" CssClass="normal"
                                                                onblur="this.className='normal'" onfocus="this.className='focus'" Width="100px"></asp:TextBox>
                                                            <%--<img id="IMG3" alt="" border="0" onclick="return IMG1_onclick()" src="Date-Picker.gif" /></a>--%>
                                                    </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>
                                                <%--<FooterStyle BackColor="White" ForeColor="#000066" />
                                                <RowStyle ForeColor="#000066" />
                                                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Center" />
                                                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                                                <PagerSettings Mode="NumericFirstLast" />--%>
                                            </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>
Posted 27-Sep-12 3:28am
Comments
Marcus Kramer 27-Sep-12 13:32pm
   
Just throwing up a big code dump isn't helpful for you or us. No one has the time to go through all that code. Could you cut out the unimportant bits so that we can see just the relevant material, please?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

For master page u can put jquery, javascript and css within the tag and for contetn page u can put it in cotent1.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Try this, replace your updatepanel with this one AJAX UpdatePanel With Inline Client Scripts Parser[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 23 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100