Solved

VB.Net RequiredFieldValidator in a DetailsView

Posted on 2007-12-05
7
1,406 Views
Last Modified: 2013-11-07
I'm using the following code to enter a project into our system.  Project name is a required field and it works fine on the edit, but I can't get it to work on the actual add.  Haven't used the validation controls a ton in the past so I'm hoping this is something simple.

Thanks in advance,

N

<asp:DetailsView
    ID="dvProjectDetails"
    DataSourceID="dsProjectDetails"
    DataKeyNames="ProjectID"
    Width="100%"
    AutoGenerateRows="False"
    runat="server">
   
    <EmptyDataTemplate>
        <table border="1">
            <tr>
                <td class="bold_8">
                    Project Name
                </td>
                <td class="bold_8">
                    <asp:TextBox id="txtProjectNameAdd" enabled="true" visible="true" Width="250px" runat="server"/><br />
                    <asp:CustomValidator
                        ID="cvTxtProjectNameAdd"
                        ErrorMessage="A project name is required to add a project."
                        runat="server" />
                 </td>
             </tr>
         </table>
    </EmptyDataTemplate>

    <Fields>
        <asp:TemplateField HeaderText="Project Name" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
            <ItemTemplate>
                <asp:Label ID="lblProjectName" Text='<%# Eval("ProjectName") %>' runat="server" />
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtProjectName" Text='<%# Bind("ProjectName") %>' Width="250px" runat="server" /><br />
                <asp:RequiredFieldValidator
                    ID="rfvTxtProjectName"
                    ControlToValidate="txtProjectName"
                    ErrorMessage="A project name is required to add a project."
                    runat="server" />
            </EditItemTemplate>
        </asp:TemplateField>
     </Fields>
</asp:DetailsView>
0
Comment
Question by:stretch73
  • 4
  • 3
7 Comments
 
LVL 10

Expert Comment

by:Alpesh Patel
ID: 20414354
Show me your whole aspx page which has all html on the page
0
 

Author Comment

by:stretch73
ID: 20414392
It's a lot:
<%@ Page Language="VB" MasterPageFile="~/BOS.master" AutoEventWireup="false" CodeFile="ProjectAdd.aspx.vb" Inherits="ProjectAdd" %>
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
 
<%@ Register Src="~/User_Controls/ddlOrg4Dot.ascx" TagName="ddl4Dot" TagPrefix="uc4Dot" %>
<%@ Register Src="~/User_Controls/ddlProjectType.ascx" TagName="ddlProjectType" TagPrefix="ucProjectType" %>
<%@ Register Src="~/User_Controls/ddlFundingType.ascx" TagName="ddlFundingType" TagPrefix="ucFundingType" %>
<%@ Register Src="~/User_Controls/ddlProjectRoles.ascx" TagName="ddlRole" TagPrefix="ucRole" %>
<%@ Register Src="~/User_Controls/ddlTechExec.ascx" TagName="ddlTechExec" TagPrefix="ucTechExec" %>
<%@ Register Src="~/User_Controls/ddlProductionManager.ascx" TagName="ddlProductionManager" TagPrefix="ucProductionManager" %>
<%@ Register Src="~/User_Controls/ddlTDM.ascx" TagName="ddlTDM" TagPrefix="ucTDM" %>
<%@ Register Src="~/User_Controls/ddlBusinessSponsor.ascx" TagName="ddlBusinessSponsor" TagPrefix="ucBusinessSponsor" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<%--main table open--%>
<table border="1" width="100%">
    <tr>
        <td valign="top" width="500">
            <asp:Panel ID="tAssignmentDetails" CssClass="collapsePanelHeader" Visible="true" runat="server">
                Project Details
            </asp:Panel>
            
            <asp:DetailsView 
                ID="dvProjectDetails" 
                DataSourceID="dsProjectDetails"
                DataKeyNames="ProjectID"
                Width="100%" 
                AutoGenerateRows="False"
                runat="server">
                
                <EmptyDataTemplate>
                    <table border="1">
                    <tr>
                        <td class="bold_8" width="150">
                            4 Dot Organization
                        </td>
                        <td class="bold_8">
                            <uc4Dot:ddl4Dot id="ddl4DotAdd" UserName="" IncludeBlank="true" UseBlank="false" BlankText="--Select a 4 Dot Organization--" BlankFirst="true" runat="server"/>          
                        </td>
                    </tr>
                    <tr>
                        <td class="bold_8">
                            Project Name
                        </td>
                        <td class="bold_8">
                            <asp:TextBox id="txtProjectNameAdd" enabled="true" visible="true" Width="250px" runat="server"/><br />
                            <asp:CustomValidator 
                                ID="cvTxtProjectNameAdd" 
                                Display="dynamic"
                                ErrorMessage="A project name is required to add a project." 
                                runat="server" />
                        </td>
                    </tr>
                    <tr> 
                        <td class="bold_8">
                            Project Type
                        </td>
                        <td>
                            <ucProjectType:ddlProjectType id="ddlProjectTypeAdd" IncludeAll="false" runat="server"/>
                        </td>
                    </tr>
                    <tr>  
                        <td class="bold_8">
                            Funding Type
                        </td>
                        <td>
                            <ucFundingType:ddlFundingType id="ddlFundingTypeAdd" IncludeAll="false" runat="server"/>
                        </td>
                    </tr>
                    <tr>
                        <td class="bold_8">
                            ECMS ID
                        </td>
                        <td class="bold_8">
                            <asp:TextBox id="txtECMSIDAdd" MaxLength="6" runat="server" />              
                        </td>
                    </tr>
                    <tr>
                        <td class="bold_8">
                            PCM ID
                        </td>
                        <td class="bold_8">
                            <asp:TextBox id="txtPCMIDAdd" MaxLength="6" runat="server" />          
                        </td>
                    </tr>
                    <tr>
                        <td class="bold_8">
                            AIT
                        </td>
                        <td>
                           <asp:TextBox id="txtAITAdd" MaxLength="5" runat="server"/>
                           <asp:CompareValidator 
                               id="AITValidator"
                               controltovalidate="txtAITAdd" 
                               text="AIT ID must be a number" 
                               operator="DataTypeCheck" 
                               type="Integer" 
                               display="dynamic" 
                               runat="server" />
                            <asp:CustomValidator 
                                id="cvAIT" 
                                text="Error" 
                                display="dynamic" 
                                runat="server" />               
                        </td>
                    </tr>
                  
                    <tr>
                        <td class="bold_8">
                            Company/Cost Center
                        </td>
                        <td class="bold_8">
                            <asp:TextBox ID="txtCompanyAdd" MaxLength="3" Width="25px" runat="server" />
                            <asp:TextBox ID="txtCostCenterAdd" MaxLength="7" Width="50px" runat="server" />
                        </td>
                    </tr> 
                    <tr>
                        <td class="bold_8">Managed</td>
                        <td>
                            <asp:CheckBox ID="chkManagedAdd" Checked="true" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="right">
                            <asp:Button 
                                ID="btnAddProject" OnClick="btnAddProject_Click"
                                EnableTheming="false" 
                                CssClass="btn_8" 
                                Text="Add" 
                                ValidationGroup="addProject" 
                                runat="server" /></td>
                    </tr>
                   </table>
                </EmptyDataTemplate>
       
                <Fields>
                    <asp:TemplateField HeaderText="Project ID" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblProjectID" Text='<%# Eval("ProjectID") %>' runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                
                    <asp:TemplateField HeaderText="Project Name" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblProjectName" Text='<%# Eval("ProjectName") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtProjectName" Text='<%# Bind("ProjectName") %>' Width="250px" runat="server" /><br />
                            <asp:RequiredFieldValidator 
                                ID="rfvTxtProjectName" 
                                ControlToValidate="txtProjectName"
                                ErrorMessage="A project name is required to add a project."
                                runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                
                    <asp:TemplateField HeaderText="Four-Dot" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblFourDot" Text='<%# Eval("FourDot") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <uc4Dot:ddl4Dot id="ddl4Dot" selectedText='<%# Bind("FourDot") %>' selectedValue='<%# Bind("FourDot") %>' EditControl="True" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Project Type" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="ProjectTypeCode" Text='<%# Eval("ProjectTypeName") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <ucProjectType:ddlProjectType id="ProjectTypeCode" selectedValue='<%# Bind("ProjectTypeCode") %>' EditControl="true" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Funding Type" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblFundingTypeCode" Text='<%# Eval("FundingTypeName") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <ucFundingType:ddlFundingType id="ddlFundingType" selectedValue='<%# Bind("FundingTypeID") %>' EditControl="true" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="AIT" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblAIT" Text='<%# Eval("AIT") %>' runat="server" />&nbsp;
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtAIT" Text='<%# Bind("AIT") %>' MaxLength="5" Width="81px" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="ECMSID" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblECMSID" Text='<%# Eval("ECMSID") %>' runat="server" />&nbsp;
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtECMSID" Text='<%# Bind("ECMSID") %>' MaxLength="6" Width="81px" runat="server" /> 
                        </EditItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="PCMID" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblPCMID" Text='<%# Eval("PCMID") %>' runat="server" />&nbsp;
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtPCMID" Text='<%# Bind("PCMID") %>' MaxLength="6" Width="81px" runat="server" /> 
                        </EditItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Company/CostCenter" HeaderStyle-Width="110px" HeaderStyle-CssClass="bold_8" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            <asp:Label ID="lblCompany" Text='<%# Eval("Company") %>' runat="server" /> - 
                            <asp:Label ID="lblCostCenter" Text='<%# Eval("CostCenter") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtCompany" Text='<%# Bind("Company") %>' MaxLength="3" Width="25px" runat="server" />
                            <asp:TextBox ID="txtCostCenter" Text='<%# Bind("CostCenter") %>' MaxLength="7" Width="50px" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
 
                    <asp:TemplateField HeaderStyle-CssClass="bold_8" HeaderText="Managed">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkManaged" Enabled="false" Checked='<%# Eval("Managed") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="chkManagedEdit" Enabled="true" Checked='<%# Bind("Managed") %>' runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
 
                    <asp:CommandField ButtonType="Button" ControlStyle-CssClass="btn_8" ShowEditButton="True" />
                </Fields>
            </asp:DetailsView>
        </td>
 
<td></td>
        
<%--right side with project, project manager, and resource  details--%>
<td align="left" valign="top" width="500">
 
<table>
<%--start governance block--%>
    <tr>
        <td>
        <cc1:CollapsiblePanelExtender 
            ID="CPEGovernance" 
            TargetControlID="cGovernance" 
            ExpandControlID="tGovernance" 
            Collapsed="false" 
            TextLabelID="lGovernance" 
            CollapseControlID="tGovernance"
            CollapsedImage="../Images/expand_blue.jpg" 
            ExpandedImage="../Images/collapse_blue.jpg"
            ImageControlID="iGovernance" 
            SuppressPostBack="true"
            runat="server" />
        
        <asp:Panel ID="tGovernance" CssClass="collapsePanelHeader" runat="server">
            <asp:Image ID="iGovernance" ImageUrl="~/Images/expand_blue.jpg" ImageAlign="absmiddle" runat="server" />
            Governance
            <asp:Label ID="lGovernance" runat="server" />
        </asp:Panel>
        
        <asp:Panel ID="cGovernance" CssClass="collapsePanel" Visible="false" runat="server">
            <table width="100%" border="0">
               <tr>
                    <td>
                    <asp:DetailsView 
                        ID="dvGovernance" 
                        DataSourceID="dsGovernance" 
                        AutoGenerateRows="false"
                        Width="100%"
                        runat="server">
                        
                        <EmptyDataTemplate>
                            <table width="100%" border="1" cellpadding="2" cellspacing="1">
                                <tr>
                                    <td colspan="2" class="normal_9">
                                        Please select your project's Governance details and click the 'Add' button.
                                        If any of your entries are not available as selections, please contact the BOS Support Team to have them added to the system.
                                    </td>
                                </tr>
                                <tr>
                                    <td class="bold_8">Tech Exec</td>
                                    <td>
                                        <ucTechExec:ddlTechExec id="ddlTechExec" EditControl="true" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="bold_8">Production Manager</td>
                                    <td>
                                        <ucProductionManager:ddlProductionManager id="ddlProductionManager" EditControl="true" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="bold_8">TDM</td>
                                    <td>
                                        <ucTDM:ddlTDM id="ddlTDM" EditControl="true" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="bold_8">Business Sponsor</td>     
                                    <td>
                                        <ucBusinessSponsor:ddlBusinessSponsor id="ddlBusinessSponsor" EditControl="true" runat="server" />
                                    </td>                 
                                </tr>
                                <tr>
                                    <td colspan="2" style="height:8px"></td>
                               </tr>
                                <tr>
                                    <td colspan="2">
                                        <asp:Button ID="cmdAddGovernance" CommandName="Add" Text="Add" runat="server" />
                                    </td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        
                        <Fields>
                            <asp:TemplateField HeaderText="ProjectID" Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="lblProjectID" Text='<%# Eval("ProjectID") %>' runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>  
                            
                            <asp:TemplateField HeaderStyle-CssClass="bold_8" HeaderText="Tech Exec" SortExpression="Tech Exec">      
                                <ItemTemplate>
                                    <asp:Label ID="lblTechExec" Text='<%# Eval("TechExecName") %>' runat="server" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <ucTechExec:ddlTechExec id="ddlTechExecEdit" SelectedText='<%# Bind("TechExecID") %>' EditControl="true" runat="server" />        
                                </EditItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderStyle-CssClass="bold_8" HeaderText="Production Manager" SortExpression="ProductionManagerName">          
                                <ItemTemplate>
                                    <asp:Label ID="lblProductionManagerName" Text='<%# Eval("ProductionManagerName") %>' runat="server" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <ucProductionManager:ddlProductionManager id="ddlProductionManagerEdit" SelectedText='<%# Bind("ProductionManagerID") %>' EditControl="true" runat="server" />
                                </EditItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderStyle-CssClass="bold_8" HeaderText="TDM Name" SortExpression="TDMName">         
                                <ItemTemplate>
                                    <asp:Label ID="lblTDM" Text='<%# Eval("TDMName") %>' runat="server" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <ucTDM:ddlTDM id="ddlTDMEdit" SelectedText='<%# Bind("TDMID") %>' EditControl="true" runat="server" />
                                </EditItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderStyle-CssClass="bold_8" HeaderText="Business Sponsor" SortExpression="BusinessSponsor">      
                                <ItemTemplate>
                                    <asp:Label ID="lblBusinessSponsor" Text='<%# Eval("BusinessSponsor") %>' runat="server" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <ucBusinessSponsor:ddlBusinessSponsor id="ddlBusinessSponsorEdit" SelectedText='<%# Bind("BusinessSponsorID") %>' EditControl="true" runat="server" />
                                </EditItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:CommandField ButtonType="Button" ControlStyle-CssClass="btn_8" ShowEditButton="True" />
                        </Fields>
                    </asp:DetailsView>
                    </td>
                </tr>
            </table>
        </asp:Panel>
        </td>
    </tr>
<%--end governance block--%>
 
<%--start project managers block--%>
 <tr>
    <td>
        <cc1:CollapsiblePanelExtender 
            ID="CPEProjectManagers" 
            TargetControlID="cProjectManagers" 
            ExpandControlID="tProjectManagers" 
            Collapsed="true" 
            TextLabelID="lProjectManagers" 
            CollapseControlID="tProjectmanagers"
            CollapsedImage="../Images/expand_blue.jpg" 
            ExpandedImage="../Images/collapse_blue.jpg"
            ImageControlID="iProjectManagers" 
            SuppressPostBack="true"
            runat="server" />
        
        <asp:Panel ID="tProjectManagers" CssClass="collapsePanelHeader" runat="server">
            <asp:Image ID="iProjectManagers" ImageUrl="~/Images/expand_blue.jpg" ImageAlign="absmiddle" runat="server" />
            Project Managers
            <asp:Label ID="lProjectManagers" runat="server" />
        </asp:Panel>
        
        <asp:Panel ID="cProjectManagers" CssClass="collapsePanel" Visible="false" runat="server">
            <table width="100%" border="1">
               <tr>
                    <td colspan="3">
                        <asp:GridView 
                            ID="gvProjectManagers" 
                            DataSourceID="dsProjectManagers"
                            DataKeyNames="ProjectManagerAssignmentID"
                            AutoGenerateColumns="False"
                            allowpaging="true"
                            Width="100%"
                            runat="server">
                            <Columns>
                                <asp:TemplateField ItemStyle-Width="45px" ItemStyle-HorizontalAlign="center">
                                    <ItemTemplate>
                                        <asp:Button 
                                            ID="btnPMDelete" 
                                            EnableTheming="false" 
                                            CssClass="btn_8" 
                                            Text="Delete" 
                                            CommandName="Delete"
                                            OnClientClick="return confirm('Are you sure you want to delete this record? This action cannot be undone.');"
                                            runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
 
                                <asp:BoundField HeaderStyle-HorizontalAlign="left" HeaderText="NBID" DataField="StandardID" />
                                <asp:BoundField HeaderStyle-HorizontalAlign="left" HeaderText="Last Name" DataField="NameLast" />
                                <asp:BoundField HeaderStyle-HorizontalAlign="left" HeaderText="First Name" DataField="NameFirst" />
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td class="bold_8" style="width:100px">Last name</td>
                    <td>
                        <asp:TextBox style="width:200px" ID="txtProjManagerSearch" runat="server" /><br />
                        <asp:RequiredFieldValidator 
                            ID="vTxtProjManagerSearch" SetFocusOnError="true"
                            ErrorMessage="Please select a project manager." 
                            ControlToValidate="txtProjManagerSearch" 
                            CssClass="normal_8" 
                            Display="Dynamic" 
                            ValidationGroup="addProjectManager"
                            runat="server" />
                        
                        <cc1:AutoCompleteExtender 
                            ID="AutoCompleteExtender1"
                            TargetControlID="txtProjManagerSearch"
                            ServicePath="../Services/AutoComplete.asmx"
                            ServiceMethod="SelectResources" 
                            MinimumPrefixLength="1" 
                            CompletionSetCount="10"
                            EnableCaching="true" 
                            runat="server">
                                <Animations>
                                    <OnShow>
                                        <Sequence>
                                            <OpacityAction Opacity='0' />
                                            <HideAction Visible='true' />
                                            <StyleAction Attribute='fontFamily' Value='Arial' />
                                            <StyleAction Attribute='fontSize' Value='8pt' />
                                            <Parallel Duration='.1'>
                                                <FadeIn />
                                                <Length PropertyKey='height' StartValue='0' EndValueScript='150' />
                                            </Parallel>
                                        </Sequence>
                                    </OnShow>
 
                                    <OnHide>
                                        <Parallel Duration='.1'>
                                            <FadeOut />
                                            <Length PropertyKey='height' StartValueScript='150' EndValue='0' />
                                        </Parallel>
                                    </OnHide>
                            </Animations>
                        </cc1:AutoCompleteExtender>
                    </td>
                     <td align="center">
                        <asp:Button ID="btnAddProjectManager" EnableTheming="false" CssClass="btn_8" Text="Add" ValidationGroup="addProjectManager" runat="server" />
                     </td>
                </tr>
            </table>
        </asp:Panel>
    </td>
</tr>
<%--end project managers block--%>
 
<%--start clarity block--%>
<tr>
    <td>
        <cc1:CollapsiblePanelExtender 
            ID="CPEClarity" 
            TargetControlID="cClarity" 
            ExpandControlID="tClarity" 
            Collapsed="true" 
            TextLabelID="lClarity" 
            CollapseControlID="tClarity"
            CollapsedImage="../Images/expand_blue.jpg" 
            ExpandedImage="../Images/collapse_blue.jpg"
            ImageControlID="iClarity" 
            SuppressPostBack="true"
            runat="server" />
        
        <asp:Panel ID="tClarity" CssClass="collapsePanelHeader" runat="server">
            <asp:Image ID="iClarity" ImageUrl="~/Images/expand_blue.jpg" ImageAlign="absmiddle" runat="server" />
            Clarity
            <asp:Label ID="lClarity" runat="server" />
        </asp:Panel>
        
        <asp:Panel ID="cClarity" CssClass="collapsePanel" Visible="false" runat="server">
            <table width="100%" border="1">
               <tr>
                    <td colspan="3">
                        <asp:GridView 
                            ID="gvClarity"
                            DataSourceID="dsClarity"
                            DataKeyNames="ClarityID"
                            AutoGenerateColumns="False" 
                            Width="100%"
                            runat="server">
                            <Columns>
                                <asp:TemplateField ItemStyle-Width="45px" ItemStyle-HorizontalAlign="center">
                                    <ItemTemplate>
                                        <asp:Button 
                                            ID="btnResourceDelete" 
                                            Text="Delete" 
                                            CommandName="Delete"
                                            EnableTheming="false"
                                            CssClass="btn_8"
                                            OnClientClick="return confirm('Are you sure you want to delete this record? This action cannot be undone.');"
                                            runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderStyle-HorizontalAlign="left" HeaderText="Clarity ID">
                                    <ItemTemplate>
                                        <asp:Label ID="ClarityID" Text='<%# Eval("ClarityID") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderStyle-HorizontalAlign="left" HeaderText="Description">
                                    <ItemTemplate>
                                        <asp:Label ID="Description" Text='<%# Eval("Description") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td class="bold_8" style="width:100px">Clarity ID</td>
                    <td>
                        <asp:TextBox style="width:50px" MaxLength="6" ID="txtClarityID" runat="server" /><br />
                        <asp:RequiredFieldValidator 
                            ID="rfvClarity" 
                            SetFocusOnError="true"
                            ErrorMessage="Please enter a valid unused Clarity number." 
                            ControlToValidate="txtClarityID" 
                            CssClass="normal_8" 
                            Display="Dynamic" 
                            ValidationGroup="addClarity"
                            runat="server" />
                    </td>
                    <td rowspan="2" align="center">
                        <asp:Button ID="btnAddClarity" EnableTheming="false" CssClass="btn_8" Text="Add" ValidationGroup="addClarity" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="bold_8">Description</td>
                    <td>
                        <asp:TextBox style="width:200px" ID="txtClarityDescription" runat="server" /><br />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        </td>
    </tr>
<%--end clarity block--%>
 
<%--start resources block--%>
    <tr>
        <td>
        <cc1:CollapsiblePanelExtender 
            ID="CPEResources" 
            TargetControlID="cResources" 
            ExpandControlID="tResources" 
            Collapsed="true" 
            TextLabelID="lResources" 
            CollapseControlID="tResources"
            CollapsedImage="../Images/expand_blue.jpg" 
            ExpandedImage="../Images/collapse_blue.jpg"
            ImageControlID="iResources" 
            SuppressPostBack="true"
            runat="server" />
        
        <asp:Panel ID="tResources" CssClass="collapsePanelHeader" runat="server">
            <asp:Image ID="iResources" ImageUrl="~/Images/expand_blue.jpg" ImageAlign="absmiddle" runat="server" />
            Resources
            <asp:Label ID="lResources" runat="server" />
        </asp:Panel>
        
        <asp:Panel ID="cResources" CssClass="collapsePanel" Visible="false" runat="server">
            <table width="100%" border="1">
               <tr>
                    <td colspan="3">
                        <asp:GridView 
                            ID="gvResources"
                            DataSourceID="dsResources" 
                            DataKeyNames="ProjectResourceAssignmentID"
                            AutoGenerateColumns="False" 
                            AllowPaging="true" 
                            AllowSorting="true" 
                            PageSize="10"
                            Width="100%"
                            runat="server">
                            <Columns>
 
                                <asp:TemplateField ItemStyle-HorizontalAlign="center">
                                    <ItemTemplate>
                                        <asp:Button 
                                            ID="btnResourceEdit" 
                                            Text="Edit" 
                                            CommandName="Edit" 
                                            EnableTheming="false"
                                            CssClass="btn_8" 
                                            runat="server" />&nbsp;
                                        <asp:Button 
                                            ID="btnResourceDelete" 
                                            Text="Delete" 
                                            CommandName="Delete"
                                            EnableTheming="false"
                                            CssClass="btn_8"
                                            OnClientClick="return confirm('Are you sure you want to delete this record? This action cannot be undone.');"
                                            runat="server" />
                                    </ItemTemplate>
                                    <EditItemTemplate> 
                                        <asp:Button 
                                            ID="btnResourceUpdate" 
                                            Text="Update" 
                                            EnableTheming="false"
                                            CssClass="btn_8"
                                            CommandName="Update" 
                                            runat="server" />
                                        <asp:Button 
                                            ID="btnResourceCancel" 
                                            Text="Cancel" 
                                            EnableTheming="false"
                                            CssClass="btn_8"
                                            CommandName="Cancel" 
                                            runat="server" />
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Role" SortExpression="ProjectRoleID" HeaderStyle-CssClass="bold_8">
                                    <ItemTemplate>
                                        <asp:Label ID="ProjectRoleName" Text='<%# Eval("ProjectRoleName") %>' runat="server" />
                                    </ItemTemplate>
                                    
                                    <EditItemTemplate> 
                                        <ucRole:ddlRole id="ddlRoleEdit" SelectedValue='<%# Bind("ProjectRoleID") %>' EditControl="true" runat="server" />
                                    </EditItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="NBID" SortExpression="StandardID" HeaderStyle-CssClass="bold_8">
                                    <ItemTemplate>
                                        <asp:Label ID="StandardID" Text='<%# Eval("StandardID") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Last Name" SortExpression="NameLast" HeaderStyle-CssClass="bold_8">
                                    <ItemTemplate>
                                        <asp:Label ID="NameLast" Text='<%# Eval("NameLast") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="First Name" SortExpression="ProjectRoleID" HeaderStyle-CssClass="bold_8">
                                    <ItemTemplate>
                                        <asp:Label ID="NameFirst" Text='<%# Eval("NameFirst") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
                
                <tr>
                    <td class="bold_8">Last name</td>
                    <td>
                        <asp:TextBox style="width:200px" ID="txtResourceSearch" runat="server" /><br />
                        <asp:RequiredFieldValidator 
                            ID="vTxtProjResourceSearch" 
                            SetFocusOnError="true"
                            ErrorMessage="Please select a resource." 
                            ControlToValidate="txtResourceSearch" 
                            CssClass="normal_8" 
                            Display="Dynamic" 
                            ValidationGroup="addResource"
                            runat="server" />
                            
                        <cc1:AutoCompleteExtender 
                            ID="AutoCompleteExtender2"
                            TargetControlID="txtResourceSearch"
                            ServicePath="../Services/AutoComplete.asmx"
                            ServiceMethod="SelectResources" 
                            MinimumPrefixLength="1" 
                            CompletionSetCount="10"
                            EnableCaching="true" 
                            runat="server">
                                <Animations>
                                    <OnShow>
                                        <Sequence>
                                            <OpacityAction Opacity='0' />
                                            <HideAction Visible='true' />
                                            <StyleAction Attribute='fontFamily' Value='Arial' />
                                            <StyleAction Attribute='fontSize' Value='8pt' />
                                            <Parallel Duration='.1'>
                                                <FadeIn />
                                                <Length PropertyKey='height' StartValue='0' EndValueScript='150' />
                                            </Parallel>
                                        </Sequence>
                                    </OnShow>
 
                                    <OnHide>
                                        <Parallel Duration='.1'>
                                            <FadeOut />
                                            <Length PropertyKey='height' StartValueScript='150' EndValue='0' />
                                        </Parallel>
                                    </OnHide>
                            </Animations>
                        </cc1:AutoCompleteExtender>
                    </td>
                    <td rowspan="2" align="center">
                        <asp:Button EnableTheming="false" ID="btnAddResource" CssClass="btn_8" Text="Add" ValidationGroup="addResource" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="bold_8">Role
                    </td>
                    <td>
                        <ucRole:ddlRole id="ddlRoleAdd" runat="server" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        </td>
    </tr>
<%--end resources block--%>
 
</table>
<%--right side table close--%>
 
        </td>
    </tr>
</table>
<%--main table close--%>
</asp:Content>

Open in new window

0
 
LVL 10

Accepted Solution

by:
Alpesh Patel earned 500 total points
ID: 20414597
You have a Add button which has assigned ValidationGroup attribute
now your Required validator for the ProjectName doesnt belog to that ValidationGroup
so it would not perform non that Control

once you assign value for ValidationGroup on the Button then it only Perform for the Control Which belong to that Perticular Group.

so either assign value to the ValidationGroup attribute for the RequiredValidator which is not performing
or you can remote ValidationGroup from the Button

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/validation/default.aspx
this is the link which can clear your concept for RequiredValidator and ValidationGroup
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

Author Comment

by:stretch73
ID: 20414830
I see what you are saying but it still doesn't work.   I tried both removing the validation group attribute from both controls and also adding it to both.  
0
 
LVL 10

Expert Comment

by:Alpesh Patel
ID: 20414900
its not possible dear

bcoz your code so long and i am not able to run that code on my machine i cant give you proper code solutions
but why dont u go through the link what i give you ...... it explain everything in detail ..... just go thorugh it and get clear by concept of ValidationGroup and just apply it to your script
it would work
i am workign with the same thing since last 1 year

thanx
0
 

Author Comment

by:stretch73
ID: 20414923
I went to the link, good suggestion, but it pretty much just reiterates what you said.  

I think the problem is that the detailsView is probably expecting this call to come from its own insert button and not one dropped into an EmptyDataTemplate.
0
 
LVL 10

Expert Comment

by:Alpesh Patel
ID: 20414985
Thats doesnt matter
let me know is it works good if you insert data witht he right data
is the data has been inserted properly without error

thanx
0

Featured Post

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.

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

827 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