asp Validator controls

6 posts, 0 answers
  1. John Davis
    John Davis avatar
    119 posts
    Member since:
    Apr 2007

    Posted 28 Apr 2008 Link to this post

    It seems asp.net validation controls do not work because references to controls that are inside RadToolbar do not work.

    Included is my example, for which I get the error:

    Unable to find control id 'lblNumSKU' referenced by the 'ControlToCompare' property of 'CompareValidator2'. 

    <%

    @ Control Language="C#" AutoEventWireup="true" CodeBehind="Report_Graph_ViewControl.ascx.cs" Inherits="BalancedFlow.WebSite3._5.Controls.Reports.Report_Graph_ViewControl" %>

    <%

    @ Register Assembly="ChartFX.WebForms" Namespace="ChartFX.WebForms" TagPrefix="chartfx7" %>

    <%

    @ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadToolbar.NET2" %>

    <%

    @ Register TagPrefix="telerik" Namespace="Telerik.WebControls" Assembly="RadComboBox.Net2" %>

    <%

    @ Register Assembly="RadInput.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>

    <%

    @ Register assembly="ChartFX.WebForms.Adornments" namespace="ChartFX.WebForms.Adornments" tagprefix="chartfxadornments" %>

    <%

    @ Register assembly="ChartFX.WebForms" namespace="ChartFX.WebForms.Galleries" tagprefix="chartfx7galleries" %>

    <style type="text/css">

    .style1

    {

    width: 872%;

    }

    .style3

    {

    font-size: small;

    }

    .style7

     

    {

    width: 95%;

    }

    .style9

    {

    height: 23px;

    }

    .style10

     {

    height: 23px;

    width: 156px;

    }

    .style11

    {

    height: 23px;

    width: 55px;

    }

    .style12

     {

    height: 23px;

    width: 85px;

    }

    .style13

     {

    height: 23px;

    width: 60px;

    }

    .style15

     {

    font-size: 12pt;

    font-family: "Times New Roman", serif;

    color: #3399FF;

    }

     </style>

    <

    asp:Label ID="lblError" runat="server" Font-Bold="True" ForeColor="Red" Width="616px"></asp:Label>

    <

    table border="0" style="width: 856px">

     <tr>

     <td style="width: 99px; height: 20px">

    <chartfx7:Chart ID="Chart1" runat="server" Width="856px" Height="461px">

     <series>

     <chartfx7:SeriesAttributes />

     <chartfx7:SeriesAttributes />

    <chartfx7:SeriesAttributes />

    </series>

    <allseries gallery="Bar">

     

    </allseries>

     

    <specialobjects>

     

    <chartfx.webforms.galleries.bar></chartfx.webforms.galleries.bar>

     

    </specialobjects>

     

    </chartfx7:Chart>

     

    </td>

     

    </tr>

     

    <tr>

     

    <td style="width: 99px">

     

    <table class="style1">

     

    <tr>

     

    <td>

     

    &nbsp;

     

    </td>

     

    <td>

     

    </td>

     

    <td style="width: 45px">

     

    &nbsp;

     

    </td>

     

    <td>

     

    &nbsp;</td>

     

    </tr>

     

    <tr>

     

    <td class="style3">

     

    Y:

    </td>

     

    <td>

     

    <asp:Panel ID="Panel1" runat="server" Height="26px" Width="580px">

     

    <table cellpadding="0" cellspacing="0" class="style4">

     

    <tr>

     

    <td>

     

    <div>

     

    <rad:RadToolbar runat="server" ID="Ybasis" Skin="Outlook" UseFadeEffect="True">

     

    <Items>

     

    <rad:RadToolbarToggleButton AccessKey="l" Toggled="True" ToolTip="DOS (Alt+L)" ButtonGroup="Basis"

     

    DisplayType="TextOnly" CommandName="DOS" />

     

    <rad:RadToolbarToggleButton AccessKey="c" ToolTip="Qty (Alt+C)" ButtonGroup="Basis"

     

    DisplayType="TextOnly" CommandName="Qty" />

     

    <rad:RadToolbarToggleButton AccessKey="r" ToolTip="Cost (Alt+R)" ButtonGroup="Basis"

     

    DisplayType="TextOnly" CommandName="Cost" />

     

    </Items>

     

    </rad:RadToolbar>

     

    </div>

     

    </td>

     

    <td>

     

    <div>

     

    <rad:RadToolbar runat="server" ID="RadtoolbarCutoff" Skin="Outlook" UseFadeEffect="True">

     

    <Items>

     

    <rad:RadToolbarButton Enabled="false" Width="5px" DisplayType="TextOnly" ButtonText=" " CommandName="b1" />

     

    <rad:RadToolbarTemplateButton AccessKey="s">

     

    <ButtonTemplate>

     

    <asp:CheckBox ID="chkCutoff" runat="server" Width="12px" Font-Size="Smaller" />

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarButton Width="29px" DisplayType="TextOnly" CommandName="Cutoff: " />

     

    <rad:RadToolbarButton Enabled="false" Width="5px" DisplayType="TextOnly" CommandName=" " />

     

    <rad:RadToolbarButton ToolTip="minus" ButtonImage="minus.gif" CommandName="minus" />

     

    <rad:RadToolbarTemplateButton AccessKey="s">

     

    <ButtonTemplate>

     

    <rad:RadNumericTextBox Skin="Default" ShowSpinButtons="false" ButtonsPosition="Right"

     

    Type="Number" MaxLength="9" MinValue="0" MaxValue="99999" Width="50" ID="txtCutoffLow"

     

    runat="server" NumberFormat-DecimalDigits="0">

     

    </rad:RadNumericTextBox>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarButton Enabled="false" Width="5px" DisplayType="TextOnly" ToolTip=" "

     

    CommandName=" " />

     

    <rad:RadToolbarButton ToolTip="plus" ButtonImage="plus.gif" CommandName="plus" />

     

    <rad:RadToolbarTemplateButton AccessKey="s">

     

    <ButtonTemplate>

     

    <rad:RadNumericTextBox Skin="Default" ShowSpinButtons="false" ButtonsPosition="Right"

     

    Type="Number" MaxLength="9" MinValue="0" MaxValue="99999" Width="50" ID="txtCutoffHigh"

     

    runat="server">

     

    </rad:RadNumericTextBox>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    </Items>

     

    </rad:RadToolbar>

     

    </div>

     

    </td>

     

    <td>

     

    &nbsp;

     

    </td>

     

    </tr>

     

    </table>

     

    </asp:Panel>

     

    </td>

     

    <td style="width: 45px">

     

    <div>

     

    <rad:RadToolbar ID="RadtoolbarRefresh" runat="server" AutoPostBack="True" Skin="Outlook"

     

    UseFadeEffect="True">

     

    <Items>

     

    <rad:RadToolbarButton AccessKey="r" ButtonImage="Refresh.gif" CommandName="Refresh"

     

    DisplayType="TextImage" ToolTip="Refresh (Alt+R)" Width="67px" />

     

    <rad:RadToolbarButton AccessKey="w" ButtonImage="Download.gif" CommandName="Download"

     

    DisplayType="TextImage" ToolTip="Download (Alt+W)" Width="67px" />

     

    </Items>

     

    </rad:RadToolbar>

     

    </div>

     

    </td>

     

    <td>

     

    &nbsp;</td>

     

    </tr>

     

    <tr>

     

    <td>

     

    &nbsp;

     

    </td>

     

    <td>

     

    <table width="100px" cellpadding="0" cellspacing="0" class="style7">

     

    <tr>

     

    <td>

     

    &nbsp;

     

    </td>

     

    <td>

     

    &nbsp;

     

    </td>

     

    <td>

     

    &nbsp;

     

    </td>

     

    </tr>

     

    </table>

     

    </td>

     

    <td style="width: 45px">

     

    &nbsp;

     

    </td>

     

    <td>

     

    &nbsp;</td>

     

    </tr>

     

    <tr>

     

    <td class="style3">

     

    X:

    </td>

     

    <td colspan="3">

     

    <rad:RadToolBar ID="RadToolBarAllX" runat="server" Skin="Outlook">

     

    <items>

     

    <rad:RadToolbarTemplateButton>

     

    <ButtonTemplate>

     

    <asp:Label ID="lblSort" Width="30px" runat="server" Text="Sort: " Font-Bold="true" Font-Size="Smaller" EnableViewState="false"></asp:Label>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarSeparator />

     

    <rad:RadToolbarToggleButton Width="30px" Toggled="True" ToolTip="DOSb" ButtonGroup="Sort"

     

    DisplayType="TextOnly" CommandName="DOSb" />

     

    <rad:RadToolbarToggleButton Width="30px" ToolTip="Dmd" ButtonGroup="Sort" DisplayType="TextOnly"

     

    CommandName="Dmd" />

     

    <rad:RadToolbarToggleButton Width="30px" ToolTip="SKU" ButtonGroup="Sort" DisplayType="TextOnly"

     

    CommandName="SKU" />

     

    <rad:RadToolbarToggleButton Width="30px" ToolTip="NetOnHand" ButtonGroup="Sort" DisplayType="TextOnly"

     

    CommandName="Net" />

     

    <rad:RadToolbarToggleButton Width="30px" ToolTip="Cost (Alt+Q)" ButtonGroup="Sort"

     

    DisplayType="TextOnly" CommandName="Cost" />

     

    <rad:RadToolbarSeparator />

     

    <rad:RadToolbarTemplateButton>

     

    <ButtonTemplate>

     

    <asp:Label ID="lblSort" Width="35px" runat="server" Text="Basis: " Font-Bold="true"

     

    Font-Size="Smaller" EnableViewState="false"></asp:Label>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarSeparator />

     

    <rad:RadToolbarToggleButton Toggled="True" ToolTip="SKU#" ButtonGroup="Basis" DisplayType="TextOnly"

     

    CommandName="SKUno" ButtonText="SKU#" />

     

    <rad:RadToolbarToggleButton ToolTip="SKU" ButtonGroup="Basis" DisplayType="TextOnly"

     

    CommandName="SKUbasis" ButtonText="SKU" />

     

    <rad:RadToolbarTemplateButton>

     

    <ButtonTemplate>

     

    <telerik:RadComboBox ID="RadComboBoxPGC" runat="server" Skin="Web20" Height="12px">

     

    </telerik:RadComboBox>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarSeparator />

     

    <rad:RadToolbarTemplateButton>

     

    <ButtonTemplate>

     

    <asp:Label ID="lblSort" Width="35px" runat="server" Text="Range: " Font-Bold="true"

     

    Font-Size="Smaller" EnableViewState="false"></asp:Label>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarTemplateButton AccessKey="s">

     

    <ButtonTemplate>

     

    <rad:RadNumericTextBox Skin="Default" ShowSpinButtons="false" ButtonsPosition="Right"

     

    Type="Number" MaxLength="9" MinValue="0" MaxValue="99999" Width="45px" ID="txtLowNum"

     

    runat="server" NumberFormat-DecimalDigits="0">

     

    </rad:RadNumericTextBox>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarTemplateButton>

     

    <ButtonTemplate>

     

    <asp:Label ID="lblSort" Width="15px" runat="server" Text="to: "

     

    Font-Size="Smaller" EnableViewState="false"></asp:Label>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarTemplateButton AccessKey="s">

     

    <ButtonTemplate>

     

    <rad:RadNumericTextBox Skin="Default" ShowSpinButtons="false" ButtonsPosition="Right"

     

    Type="Number" MaxLength="9" MinValue="0" MaxValue="99999" Width="45" ID="txtHighNum"

     

    runat="server" NumberFormat-DecimalDigits="0">

     

    </rad:RadNumericTextBox>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarTemplateButton>

     

    <ButtonTemplate>

     

    <asp:Label ID="lblSort" Width="15px" runat="server" Text="of: " Font-Size="Smaller"

     

    EnableViewState="false"></asp:Label>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarTemplateButton AccessKey="s">

     

    <ButtonTemplate>

     

    <asp:Label ID="lblNumSKU" Width="30px" runat="server"></asp:Label>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarTemplateButton AccessKey="s">

     

    <ButtonTemplate>

     

    <asp:Label ID="lblNumEOD" Width="50px" runat="server"></asp:Label>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarSeparator />

     

    <rad:RadToolbarTemplateButton>

     

    <ButtonTemplate>

     

    <asp:CheckBox ID="chkScroll" runat="server" Width="19px" Font-Size="Smaller" />

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    <rad:RadToolbarTemplateButton>

     

    <ButtonTemplate>

     

    <asp:Label ID="lblSort" Width="35px" runat="server" Text="Scroll" Font-Bold="true"

     

    Font-Size="Smaller" EnableViewState="false"></asp:Label>

     

    </ButtonTemplate>

     

    </rad:RadToolbarTemplateButton>

     

    </items>

     

    </rad:RadToolBar>

     

    </td>

     

    </tr>

     

    <tr>

     

    <td>

     

    &nbsp;

     

    </td>

     

    <td colspan="3">

     

    <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToCompare="lblNumSKU"

     

    ControlToValidate="txtHighNum" ErrorMessage="Hi &lt;= max" Height="13px" Operator="LessThanEqual"

     

    Type="Integer" Width="65px"></asp:CompareValidator>

     

    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtLowNum"

     

    ControlToValidate="txtHighNum" ErrorMessage="Hi &gt; Lo" Height="16px" Operator="GreaterThan"

     

    Type="Integer" Width="55px"></asp:CompareValidator>

     

    </td>

     

    </tr>

     

    <tr>

     

    <td class="style3" colspan="4">

     

    <table class="style1">

     

    <tr>

     

    <td class="style10">

     

    <asp:Label ID="Label6" runat="server" EnableViewState="False"

    Text="Initial Capacity (ACAP):" Width="174px" Font-Size="Smaller"></asp:Label>

     

    </td>

     

    <td class="style11">

     

    <asp:Label ID="lblAvail" runat="server" Width="73px"></asp:Label>

     

    </td>

     

    <td class="style12">

     

    <asp:Label ID="lblUseAll" runat="server"></asp:Label>

     

    </td>

     

    <td class="style13">

     

    Units:

    </td>

     

    <td class="style9">

     

    <asp:Label ID="lblCapacityUnits" runat="server" Width="107px"

    Font-Size="Smaller"></asp:Label>

     

    </td>

     

    <td class="style9">

     

    &nbsp;</td>

     

    </tr>

     

    <tr>

     

    <td class="style10">

     

    &nbsp;</td>

     

    <td class="style11">

     

    &nbsp;</td>

     

    <td class="style12">

     

    &nbsp;</td>

     

    <td class="style13">

     

    &nbsp;</td>

     

    <td class="style9">

     

    &nbsp;</td>

     

    <td class="style9">

     

    &nbsp;</td>

     

    </tr>

     

    </table>

     

    </td>

     

    </tr>

     

    <tr>

     

    <td class="style15" colspan="4">

     

    If forecast days have been set to zero,

    &nbsp;DOS values are not accurate.</td>

     

    </tr>

     

    <tr>

     

    <td class="style3" colspan="4">

     

    <asp:Label ID="lblSCS_ID" runat="server" Height="16px" Visible="False" Width="96px"></asp:Label>

     

    <asp:Label ID="lblPreviousBasis" runat="server" Height="16px" Visible="False" Width="96px"></asp:Label>

     

    <asp:Label ID="lblSCS_Name" runat="server" Height="16px" Visible="False" Width="96px"></asp:Label>

     

    </td>

     

    </tr>

     

    </table>

     

    </td>

     

    </tr>

    </

    table>

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 28 Apr 2008 Link to this post

    Hi John Davis,

    Indeed validator controls require the target control to be in the same INamingContainer. For example you cannot have the validator in your page whilst the target control is inside an user control.
    You could place the validator inside the button template as well. I hope this is a feasible workaround.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John Davis
    John Davis avatar
    119 posts
    Member since:
    Apr 2007

    Posted 28 Apr 2008 Link to this post

    Albert
    Thank you.  I tried putting the validators in a separate toolbar and in the same toolbar containing the controls referenced by the CompareValidator. I still get the error message.  Because the referenced controls are in different templates I don't see how to put the validator in "the same template" as those references.
    Steve

    <rad:RadToolbarTemplateButton>

    <ButtonTemplate>

    <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToCompare="lblNumSKU"

    ControlToValidate="txtHighNum" ErrorMessage="Hi &lt;= max" Height="13px" Operator="LessThanEqual"

    Type="Integer" Width="65px"></asp:CompareValidator>

    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtLowNum"

    ControlToValidate="txtHighNum" ErrorMessage="Hi &gt; Lo" Height="16px" Operator="GreaterThan"

    Type="Integer" Width="55px"></asp:CompareValidator>

    </ButtonTemplate>

    </rad:RadToolbarTemplateButton>

  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 28 Apr 2008 Link to this post

    Hi John Davis,

    You should put the validators in the same button as the control to validate.

    All the best,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. John Davis
    John Davis avatar
    119 posts
    Member since:
    Apr 2007

    Posted 28 Apr 2008 Link to this post

    Thank you.  I tried  putting the validator in the TemplateButton that has the 

    ControlToValidate.  But I still get "Cannot find" for the ControlToCompare.  In my toolbar theControlToValidate  and ControlToCompare must each be in a different TemplateButton. 

    Do you know of an example that shows CompareValidator working for 2 controls, each of which is inside a different TemplateButton ?  Or do you know an example that achieves the same result using javascript instead of CompareValidator ?

    Steve


    <rad:RadToolbarTemplateButton AccessKey="s">

    <ButtonTemplate>

    <rad:RadNumericTextBox Skin="Default" ShowSpinButtons="false" ButtonsPosition="Right"

    Type="Number" MaxLength="9" MinValue="0" MaxValue="99999" Width="45" ID="txtHighNum"

    runat="server" NumberFormat-DecimalDigits="0">

    </rad:RadNumericTextBox>

    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtLowNum"

    ControlToValidate="txtHighNum" ErrorMessage="Hi &gt; Lo" Height="16px" Operator="GreaterThan"

    Type="Integer" Width="55px"></asp:CompareValidator>

    </ButtonTemplate>

    </rad:RadToolbarTemplateButton>

  7. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 28 Apr 2008 Link to this post

    Hello John Davis,

    The ControlToCompare must be in the same INamingContainer (toolbar button) as well. If putting both controls in the same button is not viable you could try using the CustomValidator control.

    I hope this helps,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017