Note that there are some explanatory texts on larger screens.

plurals
  1. POShow validation message depending on each other
    primarykey
    data
    text
    <p>I have a following code in aspx page:</p> <pre><code> &lt;TABLE id="tblGeneratedTo" cellspacing="0" cellpadding="0" width="100%" align="left" border="0" runat="server"&gt; &lt;TR&gt; &lt;td width="20%" align="left"&gt;&lt;FONT face="Verdana" size="2"&gt;&lt;strong&gt;To:&lt;/strong&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/TD&gt; &lt;td width="80%"&gt; &lt;asp:textbox id="txtGeneratedTo" runat="server" CssClass="ptinput" MaxLength="10" Width="90px"&gt;&lt;/asp:textbox&gt; &lt;A onclick="window.open('../calPopUp.aspx?textbox=txtGeneratedTo','cal','width=230,height=190,left=400,top=200')" href="javascript:;"&gt; &lt;IMG src="../images/SmallCalendar.gif" border="0"&gt;&lt;/A&gt; &lt;FONT class="fontbody"&gt; (mm/dd/yyyy)&lt;/FONT&gt; &lt;/TD&gt; &lt;/TR&gt; &lt;tr&gt; &lt;td colspan="2" align="right"&gt; &lt;asp:RegularExpressionValidator ID="Regularexpressionvalidator4" runat="server" CssClass="fontbody" Display="Dynamic" ErrorMessage="*Date should be in (mm/dd/yyyy) format." ValidationExpression="^([\d]{1,2}/[\d]{1,2}/[\d]{4})$" ControlToValidate="txtGeneratedTo"&gt;&lt;/asp:RegularExpressionValidator&gt; &lt;asp:CompareValidator ID="CompareValidator6" runat="server" CssClass="fontbody" Display="Dynamic" ErrorMessage="'End' date cannot fall before 'Start' date." ControlToValidate="txtGeneratedTo" Type="Date" Operator="GreaterThanEqual" ControlToCompare="txtGeneratedFrom"&gt;&lt;/asp:CompareValidator&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/TABLE&gt; </code></pre> <p> <strong>To:</strong>&nbsp; (mm/dd/yyyy) <br> Here I have a textbox and two validation controls on it viz. regular expression and compare on actual page when I put some garbage value in textbox I see both the message at a time:</p> <p><img src="https://i.stack.imgur.com/Z3JRf.png" alt="enter image description here"></p> <p>I want to see only one message at a time. Most preferably show comparevalidator message iff regularexpression validator is satisfied or else show only regularexpression validator.</p> <p>How to achieve this? It will be easy if we can do something for this from MarkUp only rather than codebehind.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload