Note that there are some explanatory texts on larger screens.

plurals
  1. POasp.net custom control with form field validation issue
    primarykey
    data
    text
    <p>I have created a custom asp .net control some fields have validation controal associated with them. The problem arised when I declare more than one initialization on a page. When I hit submit on one of the intialized control, form validation occur on all other control that were declared. Due to this issue I cannot submit a form. Here is the code </p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="FinancialAdvisorHelp.ascx.cs" Inherits="FinancialAdvisorHelp" %&gt; &lt;table width="316" border="0" cellpadding="0" cellspacing="0"&gt; &lt;tr&gt; &lt;td colspan="2" &gt; &lt;asp:RequiredFieldValidator ID="RequiredFieldValidatorMember" runat="server" ErrorMessage="Pleae enter member name. " ControlToValidate="TextBox_Name"&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;asp:RequiredFieldValidator ID="RequiredFieldValidatorEmail" runat="server" ErrorMessage="Please enter email. " ControlToValidate="TextBox_email"&gt;&lt;/asp:RequiredFieldValidator&gt; &lt;asp:RegularExpressionValidator ID="RegularExpressionValidatorDarryEmail" runat="server" ControlToValidate="TextBox_email" ValidationExpression=".*@.*\..*" ErrorMessage="&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Invalid Email."&gt; &lt;/asp:RegularExpressionValidator&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="165"&gt;&lt;p style="font-family:Palatino Linotype; font-size:12px; margin:0; padding:0;"&gt;Member Name*&lt;/p&gt; &lt;asp:TextBox ID="TextBox_Name" runat="server" CausesValidation="True"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;td width="151" align="right"&gt;&lt;p style="font-family:Palatino Linotype; font-size:12px; margin:0 0 0 4px; padding:0; text-align:left;"&gt;E-Mail Address*&lt;/p&gt; &lt;asp:TextBox id="TextBox_email" runat="server" CausesValidation="True"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2" align="right"&gt;&lt;p style="font-family:Palatino Linotype; font-size:12px; margin:0; padding-right:50px;"&gt;&lt;br /&gt; Telephone Number&lt;/p&gt; &lt;asp:TextBox id="TextBox_phone" runat="server" CausesValidation="True"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2"&gt;&lt;p style="font-family:Palatino Linotype; font-size:12px; margin:0; padding:0;"&gt;Ask Darryl your question&lt;/p&gt; &lt;asp:TextBox ID="TextBox_question" runat="server" Rows="7" Columns="48" style="width:310px" TextMode="MultiLine"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2"&gt;&lt;p style="font-size:10px; margin:0; padding:0; float:left; width:240px; line-height:12px;"&gt;Note: you should receive a response within two (2) business days.&lt;br /&gt; *Required information.&lt;/p&gt; &lt;asp:ImageButton ID="ImageButton_Advisor" runat="server" alt="submit" width="63" height="18" style="border:0; padding:0; margin:10px 0 0 0; float:right;" ImageUrl="./images/investments/submit.gif" /&gt; &lt;asp:HiddenField ID="HiddenFieldAdvisorEmail" Value="" runat="server" /&gt; &lt;/td&gt; &lt;tr&gt;&lt;td colspan="2"&gt; &amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
    singulars
    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