Click here to Skip to main content
12,403,983 members (67,921 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET
i am using tab control for my web page and have validation summary to show the errors an i assign the same validation gropus to both validation summary and text boxes etc (button)
but when i click on button the post back occurs instead of validation

code is here

<asp:TabPanel ID="TabPanel4" runat="server" HeaderText="Phone Calls">
                                <ContentTemplate>
                                    <%--  <uc2:wucPhoneCall ID="wucPhoneCall1" runat="server" />--%>
                                    <div>
                                        <uc1:wucDisplayMessage ID="wucDisplayMessage4" runat="server" />
                                        <asp:HiddenField ID="hdfChanged_PH" runat="server" />
                                        <asp:HiddenField ID="IsLoad" runat="server" Value="0" />
                                    </div>
                                    <div>
                                        <asp:ValidationSummary ID="ValidationSummary5" EnableClientScript="false" runat="server" CssClass="msg" ValidationGroup="PhoneValidationGroup"
                                            HeaderText="Mandatory Input(s)" />
                                    </div>
                                    <asp:Panel ID="pnlPhoneCallsEntry" runat="server" DefaultButton="btnSavePH">
                                        <div class="SectionHeader">
                                            <table width="100%">
                                                <tr>
                                                    <td class="SectionHeader">
                                                        Phone Call Information
                                                        <div style="float: right;">
                                                            <asp:Button ID="btnSavePH" runat="server" CssClass="btn" Text="Save" OnClick="btnSavePH_Click"
                                                                ValidationGroup="PhoneValidationGroup" />
                                                            <asp:Button ID="btnCancelPH" runat="server" CssClass="btn" Text="Cancel" OnClick="btnCancelPH_Click"
                                                                CausesValidation="false" />
                                                        </div>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <table class="tblEntry">
                                            <tr>
                                                <td colspan="4">
                                                    <asp:UpdatePanel runat="server" ID="up" UpdateMode="Always">
                                                        <ContentTemplate>
                                                            <table class="tblEntry" id="tblPhoneCall">
                                                                <%-- <tr>
                        <td class="SectionHeader" colspan="4">
                            Phone Call Information
                        </td>
                    </tr>--%>
                                                                <tr>
                                                                    <td class="Caption2" id="tdCaptionCutomer" runat="server">
                                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="Customer is required"
                                                                            ValidationGroup="PhoneValidationGroup" ControlToValidate="ddlCustomer" CssClass="failureNotification"
                                                                            SetFocusOnError="True" InitialValue="0">*</asp:RequiredFieldValidator>
                                                                        Customer
                                                                    </td>
                                                                    <td class="Entry" id="tdEntryCutomer" runat="server">
                                                                        <asp:DropDownList runat="server" ID="ddlCustomer" CssClass="ddl" AutoPostBack="true"
                                                                            onchange="txtChanged_PH();" OnSelectedIndexChanged="ddlCustomer_SelectedIndexChanged">
                                                                        </asp:DropDownList>
                                                                    </td>
                                                                    <td colspan="2">
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class="Caption2">
                                                                        <asp:RequiredFieldValidator ID="rfvDirection" runat="server" ErrorMessage="Direction is required"
                                                                            ValidationGroup="PhoneValidationGroup" ControlToValidate="ddlDirection" CssClass="failureNotification"
                                                                            SetFocusOnError="True" InitialValue="0">&nbsp</asp:RequiredFieldValidator>
                                                                        <span class="failureNotification">*</span> Direction
                                                                    </td>
                                                                    <td class="Entry" colspan="3">
                                                                        <asp:DropDownList runat="server" ID="ddlDirection" Width="150px" CssClass="ddl" onchange="ddlPhoneType_onchange();">
                                                                            <%--OnSelectedIndexChanged="ddlDirection_SelectedIndexChanged" AutoPostBack="true"--%>
                                                                        </asp:DropDownList>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class="Caption2">
                                                                        <span class="failureNotification" runat="server" id="spanPhoneType">*</span> Phone
                                                                        Type
                                                                    </td>
                                                                    <td class="Entry">
                                                                        <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
                                                                            <Triggers>
                                                                                <asp:AsyncPostBackTrigger ControlID="ddlCustomer" EventName="SelectedIndexChanged" />
                                                                                <asp:AsyncPostBackTrigger ControlID="ddlDirection" EventName="SelectedIndexChanged" />
                                                                            </Triggers>
                                                                            <ContentTemplate>
                                                                                <asp:DropDownList runat="server" ID="ddlPhoneType" Width="150px" CssClass="ddl" AutoPostBack="true"
                                                                                    onchange="txtChanged_PH();" OnSelectedIndexChanged="ddlPhoneType_SelectedIndexChanged">
                                                                                </asp:DropDownList>
                                                                                <%--<asp:RequiredFieldValidator ID="rfvPhoneType" runat="server" ErrorMessage="Phone type is required"
                                    ValidationGroup="PhoneValidationGroup" ControlToValidate="ddlPhoneType" CssClass="failureNotification"
                                    SetFocusOnError="True" InitialValue="0">&nbsp</asp:RequiredFieldValidator>--%>
                                                                                <asp:CustomValidator ID="cvPhoneType" runat="server" ControlToValidate="ddlPhoneType"
                                                                                    ValidateEmptyText="true" ErrorMessage="Phone type is required" ClientValidationFunction="ValidatePhoneType"
                                                                                    SetFocusOnError="true" ForeColor="Red" ValidationGroup="PhoneValidationGroup">&nbsp</asp:CustomValidator>
                                                                            </ContentTemplate>
                                                                        </asp:UpdatePanel>
                                                                    </td>
                                                                    <td class="Caption2">
                                                                        <asp:FilteredTextBoxExtender ID="ftbePhone" runat="server" TargetControlID="txtPhoneNumber"
                                                                            ValidChars="0123456789 " FilterMode="ValidChars" FilterType="Custom">
                                                                        </asp:FilteredTextBoxExtender>
                                                                        <span class="failureNotification" runat="server" id="spanPhoneNumber">*</span> Phone
                                                                        Number
                                                                    </td>
                                                                    <td class="Entry">
                                                                        <%-- <asp:UpdatePanel ID="upPhoneNumber" runat="server" UpdateMode="Conditional">
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddlPhoneType" EventName="SelectedIndexChanged" />
                                    <asp:AsyncPostBackTrigger ControlID="ddlDirection" EventName="SelectedIndexChanged" />
                                    <asp:AsyncPostBackTrigger ControlID="txtPhoneNumber" />
                                </Triggers>
                                <ContentTemplate>--%>
Posted 25-Jun-13 6:27am
Comments
Ankit Kul 25-Jun-13 14:19pm
   
please write only relevant code

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.160721.1 | Last Updated 25 Jun 2013
Copyright © CodeProject, 1999-2016
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