Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET Enter key
    primarykey
    data
    text
    <p>I have a master page and based on that master page I created a page with a TextBox and two Validation controls for <code>RequiredValidator</code> and <code>RegularExpressionValidator</code> and one <code>ValidationSummary</code>.</p> <p>when pressing the enter key in TextBox, I expected that both validator show their errorMessage on validationSummary but thats not what happening it only works when I press the button on page.</p> <p>According to this page I wrapped my code with <code>&lt;asp:panel&gt;</code> and a <code>DefaultButton</code> attribute but it didn't solve the problem. <a href="http://www.codeproject.com/KB/aspnet/aspnet_Enter_key_problem.aspx" rel="nofollow">http://www.codeproject.com/KB/aspnet/aspnet_Enter_key_problem.aspx</a></p> <p>I want to know what the problem here is and whether there is any workaround?</p> <pre><code>&lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"&gt; **&lt;asp:Panel runat="server" DefaultButton="EmailSend"&gt;** &lt;table style="width: 100%"&gt; &lt;tr&gt; &lt;asp:ValidationSummary ID="EmailValidation" runat="server" CssClass="failureNotification" ValidationGroup="EmailValidation" /&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="width: 76px"&gt; Email: &lt;/td&gt; &lt;td class="style1"&gt; &lt;asp:TextBox ID="EmailForget" runat="server" Width="244px"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:RequiredFieldValidator ID="EmailRequiered" runat="server" ControlToValidate="EmailForget" CssClass="failureNotification" ErrorMessage="RequiredFieldValidator" ValidationGroup="EmailValidation"&gt;*&lt;/asp:RequiredFieldValidator&gt; &lt;asp:RegularExpressionValidator ID="EmailRegular" runat="server" ControlToValidate="EmailForget" CssClass="failureNotification" ErrorMessage="email required" ValidationGroup="EmailValidation"&gt;*&lt;/asp:RegularExpressionValidator&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="width: 76px"&gt; &amp;nbsp; &lt;/td&gt; &lt;td class="style1"&gt; &lt;asp:Button ID="EmailSend" runat="server" Text="send" Width="56px" ClientIDMode="Static" /&gt; &lt;/td&gt; &lt;td&gt; &amp;nbsp; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; **&lt;asp:Panel&gt;** &lt;/asp:Content&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    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