0
Answer

ajax is not working on the content page

Ask a question
I have created auser control for search and put it on the content page of master page. Now I am trying to add AJAX on the content page. the content page have 2 grids and these grids have templet columns and the these colomn have link button on this. Id iam aading these controls on the update panel control the then it is not working. It is working properly without ajax. I want all controls work as ajax.
Please help me....

User Control:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UC_SearchEmployee.ascx.cs" Inherits="HRMS.EIS.UI.EIS.UC_SearchEmployee" %>


<table width="100%">
        <tr>
            <td>
                Search By</td>
            <td>
                <asp:DropDownList ID="ddlSearchBy" runat="server" AutoPostBack="True" Width="230px" 
                    onselectedindexchanged="ddlSearchBy_SelectedIndexChanged">
                    <asp:ListItem Selected="True" Value="Code">Employee Code</asp:ListItem>
                    <asp:ListItem Value="First">First Name</asp:ListItem>
                    <asp:ListItem Value="Middle">Middle Name</asp:ListItem>
                    <asp:ListItem Value="Last">Last Name</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td>
                <asp:Label ID="lblSearchBy" runat="server" Text="Employee Code"></asp:Label>
            </td>
            <td><asp:TextBox ID="txtSearchString" runat="server" ClientIDMode="Static" 
                    Width="223px" Enabled="true"></asp:TextBox></td>
            <td align="center">
                <asp:Button ID="btnSearch" runat="server" ClientIDMode="Static" Text="Search" onclick="btnSearch_Click" class="cancel" />
                </td>
        </tr>
        </table>
    <table width="100%">
</table>
<table width="100%">
         <tr>
            <td>
                        <asp:GridView ID="gvSearch" runat="server" 
                    AutoGenerateColumns="False" 
                   
                    DataKeyNames="E_Employee_GUID,Person_Information_GUID,Manager_E_Employee_GUID,S_Orginization_GUID,S_User_Login_GUID,S_Depertment_GUID,S_Designation_GUID,S_Zone_GUID,S_Region_GUID,S_Division_GUID,S_Branch_GUID,S_Country_GUID,S_State_GUID,S_City_GUID" 
                    onrowediting="gvSearch_RowEditing">
                            <Columns>
                                <asp:BoundField DataField="Person_Information_GUID" 
                            HeaderText="Person Information GUID" ReadOnly="True" Visible="False" />
                                <asp:BoundField DataField="Effective_Date" HeaderText="Effective Date" Visible="false"
                            ReadOnly="True" />
                                <asp:BoundField DataField="Employee_Name" 
                            HeaderText="Employee Name" ReadOnly="True" />
                                <asp:BoundField DataField="Manager_Name" 
                            HeaderText="Manager Name" ReadOnly="True" />
                                <asp:BoundField DataField="S_User_Name" 
                            HeaderText="User Login Name" ReadOnly="True" Visible="false" />
                                <asp:BoundField DataField="Department_Name" 
                            HeaderText="Department Name" ReadOnly="True" />
                                <asp:BoundField DataField="Designation_Name" 
                            HeaderText="Designation Name" ReadOnly="True" />
                                <asp:BoundField DataField="City_Name" 
                            HeaderText="City" ReadOnly="True" Visible="false" />
                                <asp:BoundField DataField="Zone_Name" 
                            HeaderText="Zone Name" ReadOnly="True" Visible="false" />
                                <asp:BoundField DataField="Region_Name" 
                            HeaderText="Region Name" ReadOnly="True" Visible="false" />
                                <asp:BoundField DataField="Division_Name" 
                            HeaderText="Division Name" ReadOnly="True" Visible="false" />
                                <asp:BoundField DataField="Branch_Name" 
                            HeaderText="Branch Name" ReadOnly="True" Visible="false" />
                                <asp:BoundField DataField="Official_Email_Address"
                            HeaderText="Official Email" ReadOnly="True" />
                                <asp:BoundField DataField="Employee_Code"
                            HeaderText="Employee Code" ReadOnly="True" />
                                <asp:BoundField DataField="Hire_Date" Visible="false"
                            HeaderText="Hire Date" ReadOnly="True" />
                                <asp:BoundField DataField="Orignal_Hire_Date" Visible="false"
                            HeaderText="Orignal Hire Date" ReadOnly="True" />
                                <asp:BoundField DataField="Terminated_Date" Visible="false"
                            HeaderText="Terminated Date" ReadOnly="True" />
                                <asp:BoundField DataField="Employee_Status"
                            HeaderText="Employee Status" ReadOnly="True" />
                                <asp:BoundField DataField="Comments"  Visible="false"
                            HeaderText="Comments" ReadOnly="True" />
                                <asp:TemplateField HeaderText="Select" ShowHeader="False">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                    CommandName="Edit" Text="Select"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </ContentTemplate>
            </td>
        </tr>
</table>


Content Page:

<%@ Page Title="Employee Education" Language="C#" MasterPageFile="~/HRMS.Master" AutoEventWireup="true" CodeBehind="EmployeeEducation.aspx.cs" Inherits="HRMS.EIS.UI.EIS.EmployeeEducation" %>
<%@ Register src="UC_SearchEmployee.ascx" tagname="UC_SearchEmployee" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
<asp:Panel ID="pnlCreateEmployeeEducation" runat="server" GroupingText="Create Employee Education" ClientIDMode="Static">
<asp:Panel ID="pnlEmployeeSearch" runat="server" GroupingText="Employee Search" ClientIDMode="Static">
<table width="100%">
<tr>
    <td><uc1:UC_SearchEmployee ID="ucSearchEmployee" runat="server"></uc1:UC_SearchEmployee>
        </td>
    </tr>
</table>
</asp:Panel>


<asp:Panel ID="pnlEmployeeEducation" runat="server" GroupingText="Employee Education" ClientIDMode="Static">
<asp:UpdatePanel ID="UpdatePanel1" ChildrenAsTriggers="true" runat="server">
    <ContentTemplate>
<table width="100%">
        <tr>
            <td>
                Employee Name</td>
            <td>
                <asp:TextBox ID="txtEmployeeName" runat="server" ClientIDMode="Static" 
                    ReadOnly="True" Width="223px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="txtEmployeeName" 
                    ErrorMessage="Please enter the Employee Name." ValidationGroup="Education"  ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
        </tr>
        <tr>
            <td>
                Education Name</td>
            <td>
                <asp:DropDownList ID="ddlEducationName" runat="server" Width="230px">
                </asp:DropDownList>
            </td>
            <td><asp:RequiredFieldValidator InitialValue="select" ID="RequiredFieldValidator6" Display="Dynamic" ControlToValidate="ddlEducationName"
                    runat="server" ValidationGroup="Education" ErrorMessage="Please Select the Education"  ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
        </tr>
        <tr>
            <td>
                Board/University</td>
            <td>
                <asp:TextBox ID="txtBoardUniversity" runat="server" ClientIDMode="Static" 
                    Width="223px"></asp:TextBox></td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="txtBoardUniversity" 
                    ErrorMessage="Please enter the Board or University Name." 
                    ValidationGroup="Education" ForeColor="Red"></asp:RequiredFieldValidator>
                    <br />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                    ControlToValidate="txtBoardUniversity" 
                    ErrorMessage="Please enter only alphabet." ValidationExpression="^[a-z A-Z]*$" 
                    ValidationGroup="Education"  ForeColor="Red"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                Start Year</td>
            <td>
                <asp:DropDownList ID="ddlStartYear" runat="server" Width="230px">
                </asp:DropDownList>
            </td>
            <td>
                <asp:RequiredFieldValidator InitialValue="select" ID="RequiredFieldValidator7" Display="Dynamic" ControlToValidate="ddlStartYear"
                    runat="server" ValidationGroup="Education" ErrorMessage="Please Select the Start Year"  ForeColor="Red"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td>
                End Year</td>
            <td>
                <asp:DropDownList ID="ddlEndYear" runat="server" Width="230px">
                </asp:DropDownList>
            </td>
            <td>
                <asp:RequiredFieldValidator InitialValue="select" ID="RequiredFieldValidator8" Display="Dynamic" ControlToValidate="ddlEndYear"
                    runat="server" ValidationGroup="Education" ErrorMessage="Please Select the End Year"  ForeColor="Red"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td>
                Marks Percentage</td>
            <td>
                <asp:TextBox ID="txtMarks" runat="server" ClientIDMode="Static" Width="223px"></asp:TextBox></td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="txtMarks" ErrorMessage="Please enterMarks Percentage." 
                    ValidationGroup="Education"  ForeColor="Red"></asp:RequiredFieldValidator>
                    <br />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="txtMarks" ErrorMessage="Please enter only numbers." 
                    ValidationExpression="^[0-9]*" ValidationGroup="Education"  ForeColor="Red"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                Division</td>
            <td>
                <asp:DropDownList ID="ddlDivision" runat="server" Width="230px">
                    <asp:ListItem>First</asp:ListItem>
                    <asp:ListItem>Second</asp:ListItem>
                    <asp:ListItem>Third</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                Institute Name</td>
            <td>
                <asp:TextBox ID="txtInstituteName" runat="server" ClientIDMode="Static" 
                    Width="223px"></asp:TextBox></td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                    ControlToValidate="txtInstituteName" 
                    ErrorMessage="Please enter Institute Name." ValidationGroup="Education"  ForeColor="Red"></asp:RequiredFieldValidator>
                    <br />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                    ControlToValidate="txtInstituteName" ErrorMessage="Please enter only alphabet." 
                    ValidationExpression="^[a-z A-Z]*$" ValidationGroup="Education"  ForeColor="Red"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                Institute Address</td>
            <td>
                <asp:TextBox ID="txtInstituteAddress" runat="server" ClientIDMode="Static" 
                    TextMode="MultiLine" Width="223px"></asp:TextBox></td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="txtInstituteAddress" 
                    ErrorMessage="Please enter Institute Address." ValidationGroup="Education"  ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Comments</td>
            <td>
                <asp:TextBox ID="txtComments" runat="server" ClientIDMode="Static" TextMode="MultiLine" Width="223px"></asp:TextBox></td>
            <td>
                <asp:Label ID="lblEMployeeCode" runat="server" ClientIDMode="Static" 
                    Visible="false" Width="223px"></asp:Label>
                <asp:Label ID="lblEmployeeGUID" runat="server" ClientIDMode="Static" 
                    Visible="false" Width="223px"></asp:Label>
            </td>
        </tr>
    </table>
    <table width="100%">
        <tr>
            <td align="center">
                <asp:Button ID="btnAddtoGrid" runat="server" ClientIDMode="Static" onclick="btnAddtoGrid_Click" 
                    Text="Add to Table" Width="125px" ValidationGroup="Education" />
                <asp:Button ID="btnRemove" runat="server" CausesValidation="false" 
                    ClientIDMode="Static" onclick="btnRemove_Click" Text="Remove All" 
                    Width="125px" />
                <asp:Button ID="btnClear" ClientIDMode="Static" runat="server" Text="Clear All" 
                    CausesValidation="false"
                    onclick="btnClear_Click" Width="125px" />
            </td>
        </tr>
    </table>
    <table width="100%">
         <tr>
            <td>
                <asp:GridView ID="gvEmployeeEducation" runat="server" 
                    AutoGenerateColumns="False" ClientIDMode="Static" 
                    DataKeyNames="E_Employee_Education_GUID,E_Employee_GUID,S_Education_GUID" 
                    onrowdeleting="gvEmployeeEducation_RowDeleting" onrowediting="gvEmployeeEducation_RowEditing" 
                    ShowHeaderWhenEmpty="true" Width="630px">
                    <Columns>
                        <asp:BoundField DataField="E_Employee_Education_GUID" 
                            HeaderText="Employee Education GUID" ReadOnly="True" Visible="false" />
                        <asp:BoundField DataField="E_Employee_GUID" HeaderText="Employee GUID" 
                            ReadOnly="True" Visible="false" />
                        <asp:BoundField DataField="S_Education_GUID" HeaderText="Education GUID" 
                            ReadOnly="True" Visible="False" />
                        <asp:BoundField DataField="Employee_Name" HeaderText="Employee Name" 
                             ReadOnly="True" />
                         <asp:BoundField DataField="Education_Name" HeaderText="Education Name" 
                             ReadOnly="True" />
                        <asp:BoundField DataField="Board_University" HeaderText="Board/University" 
                            ReadOnly="True" />
                        <asp:BoundField DataField="Start_Year" HeaderText="Start Year" 
                            ReadOnly="True" />
                        <asp:BoundField DataField="End_Year" HeaderText="End Year" ReadOnly="True" />
                        <asp:BoundField DataField="Percentage_Marks" HeaderText="Percentage Marks" 
                            ReadOnly="True" />
                        <asp:BoundField DataField="Division" HeaderText="Division" ReadOnly="True" />
                        <asp:BoundField DataField="Institute_College_Name" HeaderText="Institute Name" 
                            ReadOnly="True" />
                        <asp:BoundField DataField="Institute_College_Address" 
                            HeaderText="Institute Address" ReadOnly="True" />
                        <asp:BoundField DataField="Comments" HeaderText="Comments" ReadOnly="True" />
                        <asp:TemplateField HeaderText="Edit/Update" ShowHeader="False">
                            <%--<EditItemTemplate>
                                <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True" 
                                    CommandName="Update" Text="Update"></asp:LinkButton>
                                &nbsp;<asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" 
                                    CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                            </EditItemTemplate>--%>
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkEdit1" runat="server" CausesValidation="False" 
                                    class="cancel" CommandName="Edit" Text="Edit"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Delete" ShowHeader="False">
                            <ItemTemplate>
                                <asp:LinkButton ID="lnkDelete1" runat="server" CausesValidation="False" 
                                    class="cancel" CommandName="Delete" Text="Delete"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
             </td>
        </tr>
         <tr>
             <td align="center">
                 <asp:Button ID="btnSave" runat="server" ClientIDMode="Static" 
                     onclick="btnSave_Click" Text="Save All" ValidationGroup="Education" Width="125px" />
             </td>
         </tr>
         <tr>
             <td>
                 <asp:GridView ID="gvEmployee" runat="server" 
                     AutoGenerateColumns="False" 
                     DataKeyNames="E_Employee_Education_GUID,E_Employee_GUID,S_Education_GUID" 
                     onrowdeleting="gvEmployee_RowDeleting" 
                     onrowediting="gvEmployee_RowEditing" Width="630px">
                     <Columns>
                         <asp:BoundField DataField="E_Employee_Education_GUID" 
                             HeaderText="Employee Education GUID" ReadOnly="True" Visible="false" />
                         <asp:BoundField DataField="E_Employee_GUID" HeaderText="Employee GUID" 
                             ReadOnly="True" Visible="false" />
                         <asp:BoundField DataField="S_Education_GUID" HeaderText="Education GUID" 
                             ReadOnly="True" Visible="False" />
                         <asp:BoundField DataField="Employee_Name" HeaderText="Employee Name" 
                             ReadOnly="True" />
                         <asp:BoundField DataField="Education_Name" HeaderText="Education Name" 
                             ReadOnly="True" />
                         <asp:BoundField DataField="Degree_Name" HeaderText="Degree Name" 
                             ReadOnly="True" />
                         <asp:BoundField DataField="Board_University" HeaderText="Board/University" 
                             ReadOnly="True" />
                         <asp:BoundField DataField="Start_Year" HeaderText="Start Year" 
                             ReadOnly="True" />
                         <asp:BoundField DataField="End_Year" HeaderText="End Year" ReadOnly="True" />
                         <asp:BoundField DataField="Percentage_Marks" HeaderText="Percentage Marks" 
                             ReadOnly="True" />
                         <asp:BoundField DataField="Division" HeaderText="Division" ReadOnly="True" />
                         <asp:BoundField DataField="Institute_College_Name" HeaderText="Institute Name" 
                             ReadOnly="True" />
                         <asp:BoundField DataField="Institute_College_Address" 
                             HeaderText="Institute Address" ReadOnly="True" />
                         <asp:BoundField DataField="Comments" HeaderText="Comments" ReadOnly="True" />
                         <asp:TemplateField HeaderText="Edit/Update" ShowHeader="False">
                             <%--<EditItemTemplate>
                                <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True" 
                                    CommandName="Update" Text="Update"></asp:LinkButton>
                                &nbsp;<asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" 
                                    CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                            </EditItemTemplate>--%>
                             <ItemTemplate>
                                 <asp:LinkButton ID="lnkEdit0" runat="server" CausesValidation="False" 
                                     class="cancel" CommandName="Edit" Text="Edit" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'></asp:LinkButton>
                             </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Delete" ShowHeader="False">
                             <ItemTemplate>
                                 <asp:LinkButton ID="lnkDelete0" runat="server" CausesValidation="False" 
                                     class="cancel" CommandName="Delete" Text="Delete"></asp:LinkButton>
                             </ItemTemplate>
                         </asp:TemplateField>
                     </Columns>
                 </asp:GridView>
             </td>
         </tr>
         <tr>
             <td>
                 &nbsp;</td>
         </tr>
    </table>
</ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>


</asp:Panel>
</asp:Content>




Next Recommended Forum