Asp: RequiredFieldValidator postback with empty fields

I ran into the following problem with my aps validator. I have a text box with an asp validator. When the user leaves the text field blank and presses the "Submit" button, a verification message is displayed, but the page performs a postback. Any ideas what might cause this?

She is a validator:

<asp:RequiredFieldValidator ID="valReqName" runat="server" 
    ControlToValidate="txtName" Display="Dynamic" ErrorMessage="blq blq">
</asp:RequiredFieldValidator>

<asp:TextBox ID="txtName" style="font-family:Tahoma, Geneva, sans-serif; 
    color: #4F4F4F;" runat="server">
</asp:TextBox>

Thanks a lot, Anton

EDIT

I have two tabs in UpdatePanel. The validation problem is part of the second tab where the user enters some inputs. When I remove this trigger:

<asp:AsyncPostBackTrigger ControlID="lnkUpload" EventName="Click" />

The postback problem was resolved, but another problem arose. Well, at least postback is removed. Thanks for all the answers.

(lnkUpload is the identifier of the second link tab button)

EDIT 2

. , , . http://jeffreypaarhuis.com/2011/08/08/validation-not-working-in-updatepanel/

+5
4

, - .

" : , javascript . , , , javascript . : , , , validation, : "

<%--dummy validator to make ajax validation possible--%>
<asp:RequiredFieldValidator runat="server" CssClass="hidden" ControlToValidate="dummyTextBox" ValidationGroup="dummy"></asp:RequiredFieldValidator>
<asp:TextBox runat="server" ID="dummyTextBox" CssClass="hidden"></asp:TextBox>

, , .

+4

:

ASP.net RequiredFieldValidator

web.config

 <xhtmlConformance mode="Legacy"/>

" , , . Google, , VisualStudio web.config - .net 1.1 .net 3.5.

, .net AJAX, , JavaScript, RequiredFieldValidator, .

+2

ValidationGroup (valReqName) .

+1

.

 EnableClientScript="True"
0

All Articles