Note that there are some explanatory texts on larger screens.

plurals
  1. POValidation on usercontrol in ajax tab control
    primarykey
    data
    text
    <p>I have a series of usercontrols nested in an ajaxToolkit:TabContainer that need to be validated. The user control has a txtFlightFrom and a txtFlightTo control and I need to make sure that is their is data in the txtFlightTo if there is data in txtFlightFrom (you can't fly out of one airport without a destination airport). I'm trying the asp:CompareValidator control for the first time but my real issue is how I triggering the validator when I proceed to the next tab. I tried doing it from my aspx page but that just causes problems and logically doesn't make sense to me. </p> <p>ascx:</p> <pre><code>&lt;asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtFlightFrom" ControlToCompare="txtFlightTo" Type="String" ErrorMessage="CompareValidator" /&gt; &lt;asp:Label ID="lblCompareTOFROM" runat="server" /&gt; &lt;asp:TextBox ID="txtFlightFrom" runat="server" /&gt; &lt;asp:TextBox ID="txtFlightTo" runat="server" /&gt; </code></pre> <p>aspx:</p> <pre><code>&lt;ajaxToolkit:TabContainer ID="TabContainer1" runat="server" AutoPostBack="true" OnActiveTabChanged="TabContainer1_ActiveTabChanged"&gt; &lt;ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="Flights"&gt; &lt;ContentTemplate&gt; &lt;ucFlight:FlightControl id="FlightControl1" Runat="server" /&gt; &lt;ucFlight:FlightControl id="FlightControl2" Runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;/ajaxToolkit:TabPanel&gt; &lt;ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="Cars"&gt; stuff &lt;/ajaxToolkit:TabPanel&gt; </code></pre> <p>ascx.cs</p> <pre><code>public string ValidateToFrom { get { return lblCompareTOFROM.Text; } set { lblCompareTOFROM.Text = value; } } </code></pre> <p>aspx.cs</p> <pre><code>if (Page.IsValid) { FlightControl1.ValidateToFrom = "Not Valid"; } </code></pre> <p>I've also tried variations of this code in the ascx.cs but that also doesn't make sense because the event is happening in the aspx.cs</p> <p>Any thoughts?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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