Solved

creating ASP.NET user control with jquery date picker

Posted on 2010-09-22
7
3,522 Views
Last Modified: 2013-11-06
Hi,
I am creating a user control which should have a date picker. I have this code in asp.net page with content place holder and ajax and it works. but when i place it in user control, it doesnot work. I dont know whether content place holder is not there or not something the way user control renders jquery.
//This does not work.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProductPickerBySeminar.ascx.cs"
 Inherits="Order.ProductPickerBySeminar" %>

 <%@ Import Namespace="WebDemo.Code" %>
<script language="javascript" type="text/javascript">

        function pageLoad() {
            $('.DatePicker').datepicker({
                showOn: "both",
                onSelect: function() { }, //IE 6 Fix
                changeMonth: true,
                changeYear: true,
                buttonImage: "../Images/Calendar.png",
                buttonImageOnly: true

            });



        }

        $(document).ready(function() {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

            function EndRequestHandler(sender, args) {
                $('.DatePicker').datepicker({
                    showOn: "both",
                    onSelect: function() { }, //IE 6 Fix
                    changeMonth: true,
                    changeYear: true,
                    buttonImage: "../Images/Calendar.png",
                    buttonImageOnly: true

                });


            }
        });

    </script>

<asp:UpdatePanel ID="SearchCriteriaUpdatePanel" runat="server">
<ContentTemplate>
  <div class="inline-param-newline">
                <div class="label">
                    <%= HtmlHelper.Label(StartDateTextBox, "Start Date")%></div>
                <div class="param">
                    <div class="param"><asp:TextBox ID="StartDateTextBox" runat="server" CssClass ="DatePicker" ></asp:TextBox></div>
                </div>
  </div>
</ContentTemplate>
</asp:UpdatePanel>

Open in new window

//This works in asp.net page with Ajax.
<%@ Page Title="" Language="C#" MasterPageFile="~/ProductTabsMaster.master" AutoEventWireup="true"
    Inherits="Pages_Seminar_Seminar" CodeBehind="Seminar.aspx.cs" %>

<%@ Register Src="~/UserControls/InnerTabs.ascx" TagName="InnerTab" TagPrefix="uc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ProductTabsHeadContentPlaceHolder"
    runat="Server">
    <link href="../Styles/jquery.timepickr.css" rel="stylesheet" type="text/css" />

    <script src="../Scripts/jquery.timepickr.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
        function pageLoad() {
            $('.DatePicker').datepicker({
                showOn: "both",
                onSelect: function() { }, //IE 6 Fix
                changeMonth: true,
                changeYear: true,
                buttonImage: "../Images/Calendar.png",
                buttonImageOnly: true

            });
            //JQuery UI TimePicker popup
            $(".TimePicker").timepickr({
                format12: "{h:2.d}:{m:02.d} {suffix:s}",
                convention: 12,
                rangeMin: ['00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55']
            });
            if (document.getElementById('<%= SessionsDayDropDownList.ClientID %>') != null) {
                ToggleTimes2();
            }
        }

        $(document).ready(function() {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

            function EndRequestHandler(sender, args) {
                $('.DatePicker').datepicker({
                    showOn: "both",
                    onSelect: function() { }, //IE 6 Fix
                    changeMonth: true,
                    changeYear: true,
                    buttonImage: "../Images/Calendar.png",
                    buttonImageOnly: true

                });
                //JQuery UI TimePicker popup
                $(".TimePicker").timepickr({
                    format12: "{h:2.d}:{m:02.d} {suffix:s}",
                    convention: 12,
                    rangeMin: ['00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55']
                });
                if (document.getElementById('<%= SessionsDayDropDownList.ClientID %>') != null) {
                    ToggleTimes2();
                }
            }
        });



        function ShowPanel(id, panelId) {
            $('#' + panelId).show(200);
            $('#' + id).parent().hide();
        }
        function ToggleTimes2() {
            var isVisible = 'none';
            var enabled = false;
            var sessionsPerDay = document.getElementById('<%= SessionsDayDropDownList.ClientID %>').value;
            if (sessionsPerDay == '1') {
                isVisible = 'none';
                enabled = false;
            }
            else if (sessionsPerDay == '2') {
                isVisible = 'block';
                enabled = true;
            }
            document.getElementById('<%= StartTime2TextBox.ClientID %>').style.display = isVisible;
            document.getElementById('<%= EndTime2TextBox.ClientID %>').style.display = isVisible;
            document.getElementById('<%= StartTime2Label.ClientID %>').style.display = isVisible;
            document.getElementById('<%= EndTime2Label.ClientID %>').style.display = isVisible;
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ProductTabsMainContentPlaceHolder"
    runat="Server">
    <asp:ScriptManager ID="scirptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <uc:InnerTab ID="SeminarInnerTab" runat="server" OnTabButtonClicked="SeminarInnerTab_OnTabButtonClicked" />
            <div style="border: solid 1px grey; padding: 10px; border-top-style: none">
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
                <asp:MultiView ID="SeminarsMultiView" runat="server">
                    <asp:View ID="SeminarInfoView" runat="server">
                        <asp:Panel ID="SeminarInfoNewPanel" runat="server">
                            <img alt="Create New Seminar" title="Create New Seminar" id="CreateImage" onclick="ShowPanel(this.id,'<%=SeminarInfoPanel.ClientID%>');"
                                src="../Images/neu/list-add.png" />Create Seminar</asp:Panel>
                        <asp:Label ID="ClasswWarningLabel" runat="server" ForeColor="Red"></asp:Label>
                        <asp:Label ID="SeminarInfoLabel" runat="server" ForeColor="Red"></asp:Label>
                        <asp:Panel ID="SeminarInfoPanel" runat="server">
                            <div style="float: right">
                                <asp:CheckBox ID="AutoGenerateSessionsCheckBox" AutoPostBack="true" Text="Auto Generate Sessions"
                                    runat="server" OnCheckedChanged="AutoGenerateSessionsCheckBox_CheckedChanged" />
                            </div>
                            <asp:Panel ID="SeminarInfoSessionsPanel" runat="server">
                                <table class="products-table">
                                    <tr>
                                        <td>
                                            Start Date<span class="req">*</span>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="StartDateTextBox" runat="server" CssClass="DatePicker"></asp:TextBox>
                                            <asp:RequiredFieldValidator ErrorMessage="StartDate Required" ID="StartDateTextBoxRequiredFieldValidator"
                                                Text="*" runat="server" ControlToValidate="StartDateTextBox"></asp:RequiredFieldValidator>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                            Sessions/Day
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="SessionsDayDropDownList" runat="server" onChange="javascript:ToggleTimes2();">
                                                <asp:ListItem Text="1" Value="1" />
                                                <asp:ListItem Selected="True" Text="2" Value="2" />
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            End Date<span class="req">*</span>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="EndDateTextBox" runat="server" CssClass="DatePicker"></asp:TextBox>
                                            <asp:RequiredFieldValidator ErrorMessage="EndDate Required" ID="EndDateTextBoxRequiredFieldValidator"
                                                Text="*" runat="server" ControlToValidate="EndDateTextBox"></asp:RequiredFieldValidator>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                            SessionType
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="DaysPerWeekDropDownList" runat="server">
                                                <asp:ListItem Text="Daily" Selected="True" Value="7" />
                                                <asp:ListItem Text="Weekly" Value="1" />
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            No Refund Date
                                        </td>
                                        <td>
                                            <asp:TextBox ID="NoRefundDateTextBox" runat="server"></asp:TextBox>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            Time Zone
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="TimeZoneDropDownList" AppendDataBoundItems="true" runat="server">
                                                <asp:ListItem Text="--" Value="-1"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Start Time 1<span class="req">*</span>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="StartTime1TextBox" runat="server" CssClass="TimePicker" />
                                            <%--<asp:RequiredFieldValidator ID="StartTimeTextBoxRequiredFieldValidator" runat="server"
                                        ControlToValidate="StartTime1TextBox" ErrorMessage="StartTime 1 Required" Text="*"></asp:RequiredFieldValidator>--%>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            <asp:Label ID="StartTime2Label" runat="server" Text="Start Time 2"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="StartTime2TextBox" runat="server" CssClass="TimePicker" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            End Time 1<span class="req">*</span>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="EndTime1TextBox" runat="server" CssClass="TimePicker" />
                                            <%-- <asp:RequiredFieldValidator ID="EndTime1TextBoxRequiredFieldValidator" runat="server"
                                        ControlToValidate="EndTime1TextBox" ErrorMessage="EndTime1 Required" Text="*"></asp:RequiredFieldValidator>--%>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            <asp:Label ID="EndTime2Label" runat="server" Text="End Time 2"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="EndTime2TextBox" runat="server" CssClass="TimePicker" />
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            <div style="clear: both">
                            </div>
                            <hr />
                            <table class="products-table">
                                <tr>
                                    <td>
                                        Seminar Date<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SeminarDateTextBox" runat="server" CssClass="DatePicker" />
                                        <asp:RequiredFieldValidator ID="SeminarDateTextBoxRequiredFieldValidator" runat="server"
                                            ControlToValidate="SeminarDateTextBox" ErrorMessage="SeminarDate Required" Text="*"></asp:RequiredFieldValidator>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                        Week Day
                                    </td>
                                    <td>
                                        <asp:TextBox ID="WeekDayTextBox" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Seats Sold
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SeatsSoldTextBox" runat="server" ReadOnly="True" />
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                        Week Night
                                    </td>
                                    <td>
                                        <asp:TextBox ID="WeekNightTextBox" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Per Diem Days
                                    </td>
                                    <td>
                                        <asp:TextBox ID="PerDiemDaysTextBox" runat="server" />
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                        Max Capacity<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="MaxCapacityTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="MaxCapacity Required" ID="MaxCapacityTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="MaxCapacityTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Sponsor Tagline
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SponsorTaglineTextBox" runat="server" />
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                        Reserved Seats
                                    </td>
                                    <td>
                                        <asp:TextBox ID="ReservedSeatsTextBox" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        &nbsp;
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Web Registration Closed
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="WebRegistrationClosedCheckBox" runat="server" />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                    <td>
                                        Private
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="PrivateCheckBox" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Cancelled
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="CancelledCheckBox" runat="server" />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                    <td>
                                        Finalized
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="FinalizedCheckBox" runat="server" />
                                    </td>
                                </tr>
                            </table>
                            <asp:Button ID="SeminarInfoSave" Text="Save" runat="server" OnClick="SeminarInfoSave_Click"
                                Style="width: 42px" />
                        </asp:Panel>
                    </asp:View>
                    <asp:View ID="InstructorsView" runat="server">
                        <asp:Label ID="InstructorsViewErrorLabel" runat="server" ForeColor="Red"></asp:Label>
                        <asp:Panel ID="InstructorsViewPanel" runat="server">
                            <asp:GridView ID="InstructorsGridView" DataKeyNames="InstructorId" AutoGenerateColumns="false"
                                runat="server" ShowFooter="true" CellSpacing="1" GridLines="None" CssClass="products-table"
                                HeaderStyle-CssClass="header" OnRowCommand="InstructorsGridView_RowCommand" RowStyle-CssClass="row"
                                OnRowDeleting="InstructorsGridView_RowDeleting" OnRowDataBound="InstructorsGridView_RowDataBound">
                                <Columns>
                                    <asp:TemplateField>
                                        <FooterTemplate>
                                            <asp:ImageButton ID="AddInstructorImageButton" runat="server" ToolTip="Add" ImageUrl="~/Images/neu/list-add.png"
                                                CommandName="Add" />
                                        </FooterTemplate>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="cmdDeleteExpense" runat="server" CausesValidation="false" CommandName="Delete"
                                                ToolTip="Delete" ImageUrl="~/Images/neu/dialog-cancel.png" OnClientClick="if (!window.confirm('Are you sure you want to delete this record?')) return false;" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField ShowHeader="true" HeaderText="Name">
                                        <ItemTemplate>
                                            <asp:Label ID="InstructorNameLabel" Text='<%#Eval("Name")%>' runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:DropDownList ID="AddInstructorDropDown" runat="server" DataTextField="Name"
                                                DataValueField="InstructorId" />
                                            <asp:HyperLink ID="ManageHyperLink" runat="server" Target="_blank" NavigateUrl="~/Pages/Instructors.aspx">Manage</asp:HyperLink>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </asp:Panel>
                    </asp:View>
                    <asp:View ID="SeminarExpensesView" runat="server">
                        <asp:Label ID="SeminarExpensesErrorLabel" runat="server" ForeColor="Red"></asp:Label>
                        <div style="position: relative; vertical-align: top; height: 300px; overflow: auto;">
                            <asp:GridView ID="ExpenseDataGrid" DataKeyNames="SeminarExpenseId" AutoGenerateColumns="false"
                                runat="server" ShowFooter="true" CellSpacing="1" GridLines="None" CssClass="products-table"
                                HeaderStyle-CssClass="header" RowStyle-CssClass="row" ItemStyle-Wrap="false"
                                FooterStyle-Wrap="false" EditItemStyle-Wrap="false" RowStyle-Wrap="false" OnRowEditing="ExpenseDataGrid_Edit"
                                OnRowCancelingEdit="ExpenseDataGrid_Cancel" OnRowUpdating="ExpenseDataGrid_Update"
                                OnRowDeleting="ExpenseDataGrid_Delete" OnRowCommand="ExpenseDataGrid_Insert"
                                OnRowDataBound="ExpenseDataGrid_ItemDataBound">
                                <Columns>
                                    <asp:TemplateField ItemStyle-Wrap="false">
                                        <EditItemTemplate>
                                            <asp:ImageButton ID="cmdUpdateExpense" runat="server" CausesValidation="false" CommandName="Update"
                                                ToolTip="Update" ImageUrl="~/Images/neu/media-floppy.png" />
                                            <asp:ImageButton ID="cmdCancelUpdateExpense" runat="server" CausesValidation="false"
                                                CommandName="Cancel" ToolTip="Cancel" ImageUrl="~/Images/neu/edit-undo.png" />
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="cmdDeleteExpense" runat="server" CausesValidation="false" CommandName="Delete"
                                                ToolTip="Delete" ImageUrl="~/Images/neu/dialog-cancel.png" OnClientClick="if (!window.confirm('Are you sure you want to delete this record?')) return false;" />
                                            <asp:ImageButton ID="cmdEditExpense" runat="server" CausesValidation="false" CommandName="Edit"
                                                ToolTip="Edit" ImageUrl="~/Images/neu/accessories-text-editor.png" />
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:ImageButton ID="cmdAddExpense" runat="server" CausesValidation="false" CommandName="Add"
                                                ToolTip="Add" ImageUrl="~/Images/neu/list-add.png" />
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Cost Center">
                                        <EditItemTemplate>
                                            <asp:DropDownList ID="CostCenterDropDown" runat="server" DataTextField="CostCenterID"
                                                DataValueField="CostCenterID">
                                            </asp:DropDownList>
                                            <span class="req">*</span>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <%# DataBinder.Eval(Container.DataItem, "CostCenterID")%>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:DropDownList ID="CostCenterAddDropDown" runat="server" DataTextField="CostCenterID"
                                                DataValueField="CostCenterID">
                                            </asp:DropDownList>
                                            <span class="req">*</span>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Dept. Code">
                                        <EditItemTemplate>
                                            <asp:DropDownList ID="DeptCodeDropDown" runat="server" DataTextField="DeptCode" DataValueField="DeptCode">
                                            </asp:DropDownList>
                                            <span class="req">*</span>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <%# DataBinder.Eval(Container.DataItem, "DeptCode")%>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:DropDownList ID="DeptCodeAddDropDown" runat="server" DataTextField="DeptCode"
                                                DataValueField="DeptCode">
                                            </asp:DropDownList>
                                            <span class="req">*</span>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="GL Account">
                                        <EditItemTemplate>
                                            <asp:DropDownList ID="AccountCodeDropDown" runat="server" DataTextField="CodeAndDescription"
                                                DataValueField="AccountCodes">
                                            </asp:DropDownList>
                                            <span class="req">*</span>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <%# DataBinder.Eval(Container.DataItem, "AccountCode")%>
                                            -
                                            <%# DataBinder.Eval(Container.DataItem, "CodeDescription")%>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:DropDownList ID="AccountCodeAddDropDown" runat="server" DataTextField="CodeAndDescription"
                                                DataValueField="AccountCodes">
                                            </asp:DropDownList>
                                            <span class="req">*</span>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Incur Month">
                                        <EditItemTemplate>
                                            <asp:DropDownList ID="IncurMonthDropDown" runat="server">
                                                <asp:ListItem Value="" Text="" />
                                                <asp:ListItem Value="1" Text="Jan." />
                                                <asp:ListItem Value="2" Text="Feb." />
                                                <asp:ListItem Value="3" Text="March" />
                                                <asp:ListItem Value="4" Text="April" />
                                                <asp:ListItem Value="5" Text="May" />
                                                <asp:ListItem Value="6" Text="June" />
                                                <asp:ListItem Value="7" Text="July" />
                                                <asp:ListItem Value="8" Text="Aug." />
                                                <asp:ListItem Value="9" Text="Sept." />
                                                <asp:ListItem Value="10" Text="Oct." />
                                                <asp:ListItem Value="11" Text="Nov." />
                                                <asp:ListItem Value="12" Text="Dec." />
                                            </asp:DropDownList>
                                            <span class="req">*</span>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <%#Server.HtmlDecode((((int)DataBinder.Eval(Container.DataItem, "IncurMonth")) == 0) ? "" : Convert.ToDateTime("2000/" + Convert.ToString(DataBinder.Eval(Container.DataItem, "IncurMonth")) + "/01").ToString("MMM"))%>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:DropDownList ID="IncurMonthAddDropDown" runat="server">
                                                <asp:ListItem Value="" Text="" />
                                                <asp:ListItem Value="1" Text="Jan." />
                                                <asp:ListItem Value="2" Text="Feb." />
                                                <asp:ListItem Value="3" Text="March" />
                                                <asp:ListItem Value="4" Text="April" />
                                                <asp:ListItem Value="5" Text="May" />
                                                <asp:ListItem Value="6" Text="June" />
                                                <asp:ListItem Value="7" Text="July" />
                                                <asp:ListItem Value="8" Text="Aug." />
                                                <asp:ListItem Value="9" Text="Sept." />
                                                <asp:ListItem Value="10" Text="Oct." />
                                                <asp:ListItem Value="11" Text="Nov." />
                                                <asp:ListItem Value="12" Text="Dec." />
                                            </asp:DropDownList>
                                            <span class="req">*</span>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Estimated Cost">
                                        <FooterTemplate>
                                            <asp:TextBox ID="EstimatedCostAddTextBox" Columns="7" runat="Server" /><span class="req">*</span>
                                        </FooterTemplate>
                                        <ItemTemplate>
                                            <%# DataBinder.Eval(Container.DataItem, "EstimatedCost", "{0:c}")%>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="EstimatedCostTextBox" Columns="7" Text='<%# DataBinder.Eval(Container.DataItem, "EstimatedCost") %>'
                                                runat="server" /><span class="req">*</span>
                                        </EditItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Actual Cost">
                                        <FooterTemplate>
                                            <asp:TextBox ID="ActualCostAddTextBox" Columns="7" runat="Server" />
                                        </FooterTemplate>
                                        <ItemTemplate>
                                            <%# DataBinder.Eval(Container.DataItem, "ActualCost", "{0:c}")%>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="ActualCostTextBox" Columns="7" Text='<%# DataBinder.Eval(Container.DataItem, "ActualCost") %>'
                                                runat="server" />
                                        </EditItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Instructor">
                                        <EditItemTemplate>
                                            <asp:DropDownList ID="InstructorDropDown" runat="server" DataTextField="Name" DataValueField="InstructorID">
                                            </asp:DropDownList>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <%# DataBinder.Eval(Container.DataItem, "InstructorName")%>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:DropDownList ID="InstructorAddDropDown" runat="server" DataTextField="Name"
                                                DataValueField="InstructorID">
                                            </asp:DropDownList>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Notes">
                                        <FooterTemplate>
                                            <asp:TextBox ID="NotesAddTextBox" Columns="50" runat="Server" />
                                        </FooterTemplate>
                                        <ItemTemplate>
                                            <%# DataBinder.Eval(Container.DataItem, "Notes")%>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="NotesTextBox" Columns="50" Text='<%# DataBinder.Eval(Container.DataItem, "Notes") %>'
                                                runat="server" />
                                        </EditItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <HeaderStyle CssClass="header" />
                            </asp:GridView>
                        </div>
                    </asp:View>
                    <asp:View ID="SeminarLocationInfoView" runat="server">
                        <asp:Label ID="SeminarLocationErrorLabel" runat="server" ForeColor="Red"></asp:Label>
                        <asp:Panel ID="SeminarLocationNewPanel" runat="server">
                            <img alt="Create New Location" title="Create New Location" id="CreateLocationImage"
                                onclick="ShowPanel(this.id, '<%=SeminarLocationPanel.ClientID%>');" src="../Images/neu/list-add.png" />Create
                            Location</asp:Panel>
                        <asp:Panel ID="SeminarLocationPanel" Width="100%" runat="server">
                            <table cellspacing="0" class="products-table">
                                <tr>
                                    <td>
                                        Seminar
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="SeminarLocSeminarTextBox" runat="server" />
                                    </td>
                                    <td>
                                        Address<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="SeminarLocAddressTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="Address Required" ID="SeminarLocAddressTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="SeminarLocAddressTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Location<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="SeminarLocLocationTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="Location Required" ID="SeminarLocLocationTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="SeminarLocLocationTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                    <td>
                                        Address 2
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="SeminarLocAddress2TextBox" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Room
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="SeminarRoomTextBox" runat="server"></asp:TextBox>
                                    </td>
                                    <td>
                                        Address 3
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="SeminarLocAddress3TextBox" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Phone
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SeminarLocPhoneTextBox" runat="server" />
                                    </td>
                                    <td>
                                        City<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SeminarLocCityTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="City Required" ID="SeminarLocCityTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="SeminarLocCityTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Location URL
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="SeminarLocLocationURLTextBox" runat="server" />
                                    </td>
                                    <td>
                                        State<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SeminarLocStateTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="State Required" ID="SeminarLocStateTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="SeminarLocStateTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Map Quest URL
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="SeminarLocMapQuestURLTextBox" runat="server" />
                                    </td>
                                    <td>
                                        Zip<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SeminarLocZipTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="Zip Required" ID="SeminarLocZipTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="SeminarLocZipTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Notes
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" Height="100px" ID="SeminarLocNotesTextBox"
                                            runat="server" TextMode="MultiLine" />
                                    </td>
                                    <td valign="top">
                                        Country<span class="req">*</span>
                                    </td>
                                    <td valign="top">
                                        <asp:DropDownList ID="SeminarLocCountryDropDownList" Width="300px" runat="server"
                                            AppendDataBoundItems="true" DataTextField="CountryName" DataValueField="CountryName">
                                            <asp:ListItem Text="-" Value="-1"></asp:ListItem>
                                        </asp:DropDownList>
                                        <asp:CompareValidator ID="SeminarLocCountryDropDownListValidator" Text="*" runat="server"
                                            ControlToValidate="SeminarLocCountryDropDownList" ErrorMessage="Country Required"
                                            Operator="NotEqual" ValueToCompare="-1"></asp:CompareValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                    </td>
                                    <td colspan="2">
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Button ID="SeminarLocationSave" Text="Save" runat="server" OnClick="SeminarLocationSave_Click" />
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="CopyToHotelInfoCheckBox" runat="server" Text="Duplicate Information To Hotel" />
                                    </td>
                                    <td colspan="2">
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </asp:View>
                    <asp:View ID="HotelInfoView" runat="server">
                        <asp:Label ID="HotelInfoErrorLabel" runat="server" ForeColor="Red"></asp:Label>
                        <asp:Panel ID="HotelInfoNewPanel" runat="server">
                            <img alt="Add New Hotel Info" title="Add New Hotel Info" id="Img1" onclick="ShowPanel(this.id, '<%=HotelInfoPanel.ClientID%>');"
                                src="../Images/neu/list-add.png" />Add Hotel Info</asp:Panel>
                        <asp:Panel ID="HotelInfoPanel" runat="server" Width="100%">
                            <table cellspacing="0" class="products-table">
                                <tr>
                                    <td>
                                        Hotel
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="HotelInfoHotelTextBox" runat="server" />
                                    </td>
                                    <td>
                                        Address<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="HotelInfoAddressTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="Address Required" ID="HotelInfoAddressTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="HotelInfoAddressTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Location<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="HotelInfoLocationTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="InfoLocation Required" ID="HotelInfoLocationTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="HotelInfoLocationTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                    <td>
                                        Address 2
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="HotelInfoAddress2TextBox" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Phone
                                    </td>
                                    <td>
                                        <asp:TextBox ID="HotelInfoPhoneTextBox" runat="server" />
                                    </td>
                                    <td>
                                        Address 3
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="HotelInfoAddress3TextBox" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Weekday Rate
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="HotelInfoWeekDayRateTextBox" runat="server" />
                                    </td>
                                    <td>
                                        City<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="HotelInfoCityTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="City Required" ID="HotelInfoCityTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="HotelInfoCityTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Rooms Held Until
                                    </td>
                                    <td>
                                        <asp:TextBox ID="HotelInfoRoomsHeldUntilTextBox" runat="server" CssClass="DatePicker"></asp:TextBox>
                                    </td>
                                    <td>
                                        State<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="HotelInfoStateTextBox" runat="server" CausesValidation="True" />
                                        <asp:RequiredFieldValidator ErrorMessage="State Required" ID="HotelInfoStateTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="HotelInfoStateTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Hotel URL
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="HotelInfoHotelURLTextBox" runat="server" />
                                    </td>
                                    <td>
                                        Zip<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="HotelInfoZipTextBox" runat="server" />
                                        <asp:RequiredFieldValidator ErrorMessage="Zip Required" ID="HotelInfoZipTextBoxRequiredFieldValidator"
                                            Text="*" runat="server" ControlToValidate="HotelInfoZipTextBox"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Map Quest URL
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="SeminarTextBox" ID="HotelInfoMapQuestURLTextBox" runat="server" />
                                    </td>
                                    <td>
                                        Country<span class="req">*</span>
                                    </td>
                                    <td>
                                        <asp:DropDownList Width="300px" ID="HotelInfoCountryDropDownList" AppendDataBoundItems="true"
                                            runat="server" DataTextField="CountryName" DataValueField="CountryName">
                                            <asp:ListItem Text="-" Value="-1"></asp:ListItem>
                                        </asp:DropDownList>
                                        <asp:CompareValidator ID="HotelInfoCountryDropDownListValidator" Text="*" runat="server"
                                            ControlToValidate="HotelInfoCountryDropDownList" ErrorMessage="Country Required"
                                            Operator="NotEqual" ValueToCompare="-1">
                                        </asp:CompareValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="1">
                                        Notes
                                    </td>
                                    <td colspan="3">
                                        <asp:TextBox Width="300px" ID="HotelInfoNotesTextBox" runat="server" Height="100px"
                                            TextMode="MultiLine" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                    </td>
                                    <td colspan="2">
                                    </td>
                                </tr>
                            </table>
                            <asp:Button ID="HotelInfoSave" Text="Save" runat="server" OnClick="HotelInfoSave_Click" />
                        </asp:Panel>
                    </asp:View>
                    <asp:View ID="SeminarSessionsView" runat="server">
                        <asp:Label ID="SeminarSesssionsErrorLabel" runat="server" ForeColor="Red"></asp:Label>
                        <asp:Panel ID="SeminarSesssionsPanel" runat="server">
                            <asp:GridView ID="SeminarSesssionsGridView" DataKeyNames="SeminarInfoId,StartAt"
                                AutoGenerateColumns="false" runat="server" ShowFooter="true" CellSpacing="1"
                                GridLines="None" CssClass="products-table" HeaderStyle-CssClass="header" RowStyle-CssClass="row"
                                OnRowCancelingEdit="SeminarSesssionsGridView_RowCancelingEdit" OnRowCommand="SeminarSesssionsGridView_RowCommand"
                                OnRowDeleting="SeminarSesssionsGridView_RowDeleting" OnRowEditing="SeminarSesssionsGridView_RowEditing"
                                OnRowUpdating="SeminarSesssionsGridView_RowUpdating" RowStyle-Wrap="false" OnRowDataBound="SeminarSesssionsGridView_RowDataBound">
                                <Columns>
                                    <asp:TemplateField>
                                        <EditItemTemplate>
                                            <asp:ImageButton ID="cmdUpdateSession" runat="server" CausesValidation="false" CommandName="Update"
                                                ToolTip="Update" ImageUrl="~/Images/neu/media-floppy.png" />
                                            <asp:ImageButton ID="cmdCancelUpdateSession" runat="server" CausesValidation="false"
                                                CommandName="Cancel" ToolTip="Cancel" ImageUrl="~/Images/neu/edit-undo.png" />
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="cmdDeleteSession" runat="server" CausesValidation="false" CommandName="Delete"
                                                ToolTip="Delete" ImageUrl="~/Images/neu/dialog-cancel.png" />
                                            <asp:ImageButton ID="cmdEditSession" runat="server" CausesValidation="false" CommandName="Edit"
                                                ToolTip="Edit" ImageUrl="~/Images/neu/accessories-text-editor.png" />
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:ImageButton ID="cmdAddSession" runat="server" CausesValidation="false" CommandName="Add"
                                                ToolTip="Add" ImageUrl="~/Images/neu/list-add.png" />
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField ShowHeader="true" HeaderText="StartDate">
                                        <ItemTemplate>
                                            <asp:Label ID="SeminarStartDateLabel" Text='<%# DataBinder.Eval(Container.DataItem, "SeminarStartDate", "{0:d}")%>'
                                                runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="EditSeminarStartDateTextBox" Text='<%# DataBinder.Eval(Container.DataItem, "SeminarStartDate", "{0:d}")%>'
                                                CssClass="DatePicker" runat="server"></asp:TextBox>
                                        </EditItemTemplate>
                                        <FooterTemplate>
                                            <asp:TextBox ID="AddSeminarStartDateTextBox" CssClass="DatePicker" runat="server" Width="80%"></asp:TextBox>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField ShowHeader="true" HeaderText="StartTime">
                                        <ItemTemplate>
                                            <asp:Label ID="SeminarStartTimeLabel" Text='<%#Eval("StartAtString")%>' runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="EditSeminarStartTimeTextBox" CssClass="TimePicker" Text='<%#Eval("StartAtString")%>'
                                                runat="server"></asp:TextBox>
                                        </EditItemTemplate>
                                        <FooterTemplate>
                                            <asp:TextBox ID="AddSeminarStartTimeTextBox" CssClass="TimePicker" runat="server"></asp:TextBox>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField ShowHeader="true" HeaderText="EndTime">
                                        <ItemTemplate>
                                            <asp:Label ID="SeminarEndTimeLabel" Text='<%#Eval("EndAtString")%>' runat="server"></asp:Label>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="EditSeminarEndTimeTextBox" CssClass="TimePicker" Text='<%#Eval("EndAtString")%>'
                                                runat="server"></asp:TextBox>
                                        </EditItemTemplate>
                                        <FooterTemplate>
                                            <asp:TextBox ID="AddSeminarEndTimeTextBox" CssClass="TimePicker" runat="server"></asp:TextBox>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField ShowHeader="true" HeaderText="Instructor">
                                        <EditItemTemplate>
                                            <asp:DropDownList ID="EditSeminarInstructorDropDown" runat="server" DataTextField="Name"
                                                DataValueField="InstructorID">
                                            </asp:DropDownList>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                      
                                            <asp:Label ID="InstructorNameLabel" Text='<%#Eval("name")%>' runat="server"> </asp:Label>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:DropDownList ID="AddSeminarInstructorDropDown" runat="server" DataTextField="Name"
                                                DataValueField="InstructorID" Width="80%">
                                            </asp:DropDownList>
                                        </FooterTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </asp:Panel>
                    </asp:View>
                </asp:MultiView>
            </div>
            <div style="clear: both;">
            </div>
            <div style="padding-top: 10px">
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

Open in new window

0
Comment
Question by:Dattu
  • 4
  • 2
7 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 33737739
When you say doesn't work, what exactly is happening?
Any js errors? make sure you browser is enabled displaying JS errors.
0
 

Author Comment

by:Dattu
ID: 33737772
Uncaugth Type Error: Object <#Object> has no method 'DatePicker'

0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33739331
I have used once that datetimepicker and that too inside a UC.
But I had my jquery code inside a separate .js file. I added the script reference to that file inside head of MasterPage.
Try that way and see.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:Dattu
ID: 33922274
since, I am using JQuery in user control and calling it from aspx which also has jquery, we need to reference all the jquery libraries we are using the user control in aspx page body like asp:content place holder, etc.
0
 

Author Comment

by:Dattu
ID: 33922279
my last comment is the correct. so please mark  my last comment as an answer and close the question.
0
 

Accepted Solution

by:
Dattu earned 0 total points
ID: 33922282
since, I am using JQuery in user control and calling it from aspx which also has jquery, we need to reference all the jquery libraries we are using the user control in aspx page body like asp:content place holder, etc.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to refer to value 8 49
encoding an href string 2 21
Converting dates in JavaScript 2 35
ASP.NET MVC -Add authentication 2 21
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question