English 中文(简体)
我如何根据我数据动态网站同一表格中的数据验证一个领域?
原标题:How do I validate one field based on the data in the another in the same table in my Dynamic Data Website?

我在我的动态数据网站上有一个表格,它拥有一个主要的电话号码领域和国家领域。 我经常向电话领域表达,以证实美国国内电话号码和国际电话号码。 我如何在动态数据应用中写道,如果我们以外的国家被选定在国家领域,那么国际电话的定期表述就应当使用?

<asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
        AllowPaging="True" AllowSorting="True" CssClass="DDGridView"
        RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6" AutoGenerateColumns="false" AutoGenerateEditButton="true" AutoGenerateSelectButton="true" AutoGenerateDeleteButton="true">
        <Columns>                    
            <%--<asp:TemplateField>
                <ItemTemplate>
                    <asp:DynamicHyperLink runat="server" Action="Edit" Text="Edit"
                    />&nbsp;<asp:LinkButton runat="server" CommandName="Delete" Text="Delete"
                        OnClientClick= return confirm("Are you sure you want to delete this item?"); 
                    />&nbsp;<asp:DynamicHyperLink runat="server" Text="Details" />
                </ItemTemplate>
            </asp:TemplateField>--%>

            <asp:DynamicField DataField="CA_AgencyName" HeaderText="Agency Name" />
            <asp:DynamicField DataField="CA_AgencyAcronym" HeaderText="Official Acronym"/>
            <asp:DynamicField DataField="CA_AgencyAcronym_SOLID" HeaderText="SOLID Acronym"/>
            <asp:DynamicField DataField="CA_AgencyHomePageURL" UIHint="Url" HeaderText="Web Address"/>
            <asp:DynamicField DataField="CA_AgencyContact" HeaderText="Email/Contact Page"/>
            <asp:DynamicField DataField="CA_AgencyCredentialType" HeaderText="Credential Type"/>
            <asp:DynamicField DataField="CA_AgencyStreetAddress1" HeaderText="Address"/>
            <asp:DynamicField DataField="CA_AgencyStreetAddress2" HeaderText="Address Cont."/>
            <asp:DynamicField DataField="CA_AgencyCity" HeaderText="City"/>
            <asp:DynamicField DataField="CA_AgencyState" HeaderText="State"/>
            <asp:DynamicField DataField="CA_AgencyZip" HeaderText="Zip"/>
            <asp:DynamicField DataField="CA_AgencyCountry" HeaderText="Country" />
            <asp:DynamicField DataField="CA_AgencyPhonePrimary" HeaderText="Primary Phone"/>
            <asp:DynamicField DataField="CA_AgencyPhonePrimaryExtension" HeaderText="Primary Extension"/>
            <asp:DynamicField DataField="CA_AgencyPhoneSecondary" HeaderText="Secondary Phone"/>
            <asp:DynamicField DataField="CA_AgencyRecordAddedUserID" HeaderText="Added By"/>
            <asp:DynamicField DataField="CA_AgencyRecordUpdatedDate" HeaderText="Date Changed"/>
            <asp:DynamicField DataField="CA_AgencyRecordUpdatedUserID" HeaderText="Changed By"/>
            <asp:DynamicField DataField="DOL_ORG_ID" HeaderText="DOL ORG ID"/>
        </Columns>

        <PagerStyle CssClass="DDFooter"/>        
        <PagerTemplate>
            <asp:GridViewPager runat="server" />
        </PagerTemplate>
        <EmptyDataTemplate>
            There are currently no items in this table.
        </EmptyDataTemplate>
    </asp:GridView>
最佳回答

It sounds like what you need is a CompareValidator:

<asp:CompareValidator ID="CompareValidator1" runat="server" 
    ControlToValidate="MyControl1" 
    ControlToCompare="MyControl2" 
    Operator="GreaterThanEqual" 
    Type="Integer">
</asp:CompareValidator>
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签