CochiseCounty
asked on
OnClick event does not work when using RequiredFieldValidator Control
I have this same code on a page on Intranet site and a page on Internet site, the one on the intranet site works fine, but the one on internet site doesn't work (when I click the submit button, the onclick event doesn't do anthing, nothing happen). I think there is something going on with the setting up with the project, but I don't know what it is. Please help! Thanks.
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Sql Client" %>
<SCRIPT RUNAT="SERVER">
Sub btnSubmit_Click (obj As Object, e As EventArgs)
Response.Write ("Valid")
End Sub
</Script>
<HTML>
<HEAD>
<title>Login</title>
</HEAD>
<body>
<form Runat="Server" id=form1>
<TABLE WIDTH="90%" BORDER="0" CELLSPACING="1" CELLPADDING="1">
<TR>
<TD colSpan="4"> <BR>
<FONT face="Arial" color="#006600" size="2"><STRONG>Return user? Please login</STRONG></FONT></TD>
</TR>
<TR>
<TD><FONT face="Arial"><FONT size="2"><STRONG>Username: <FONT color="#cc0033">*</FONT></ STRONG></F ONT></FONT ></TD>
<TD>
<asp:TextBox ID="txtUserName" MaxLength="10" Runat="Server"></asp:TextB ox>
<asp:RequiredFieldValidato r ControlToValidate="txtUser Name" Text="The Username field is missing." Runat="server"></asp:Requi redFieldVa lidator>
<FONT face="Arial" size="2"></FONT>
</TD>
</TR>
<TR>
<TD><FONT face="Arial"><FONT size="2"><STRONG>Password: <FONT color="#cc0033">*</FONT></ STRONG></F ONT></FONT ></TD>
<TD>
<asp:TextBox ID="txtPassword" MaxLength="10" Runat="Server" TextMode="Password"></asp: TextBox>
<asp:RequiredFieldValidato r ControlToValidate="txtPass word" Text="The password field is missing." Runat="server"></asp:Requi redFieldVa lidator><F ONT face="Arial" size="2"></FONT>
</TD>
</TR>
<TR>
<TD colspan="4"> <BR>
<asp:button
onclick="btnSubmit_Click"
text="Submit Form!" runat="server" ID="Button1"/>
</TD>
</TR>
</TABLE>
</form>
</body>
</HTML>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Sql
<SCRIPT RUNAT="SERVER">
Sub btnSubmit_Click (obj As Object, e As EventArgs)
Response.Write ("Valid")
End Sub
</Script>
<HTML>
<HEAD>
<title>Login</title>
</HEAD>
<body>
<form Runat="Server" id=form1>
<TABLE WIDTH="90%" BORDER="0" CELLSPACING="1" CELLPADDING="1">
<TR>
<TD colSpan="4"> <BR>
<FONT face="Arial" color="#006600" size="2"><STRONG>Return user? Please login</STRONG></FONT></TD>
</TR>
<TR>
<TD><FONT face="Arial"><FONT size="2"><STRONG>Username:
<TD>
<asp:TextBox ID="txtUserName" MaxLength="10" Runat="Server"></asp:TextB
<asp:RequiredFieldValidato
<FONT face="Arial" size="2"></FONT>
</TD>
</TR>
<TR>
<TD><FONT face="Arial"><FONT size="2"><STRONG>Password:
<TD>
<asp:TextBox ID="txtPassword" MaxLength="10" Runat="Server" TextMode="Password"></asp:
<asp:RequiredFieldValidato
</TD>
</TR>
<TR>
<TD colspan="4"> <BR>
<asp:button
onclick="btnSubmit_Click"
text="Submit Form!" runat="server" ID="Button1"/>
</TD>
</TR>
</TABLE>
</form>
</body>
</HTML>
ASKER
Yes, when I remove the field validator, the page works fine.
What is asp_regiis and how to run it? Thanks.
What is asp_regiis and how to run it? Thanks.
http://support.microsoft.com/default.aspx?scid=kb;en-us;306005
To fix IIS mappings for ASP.NET, run the Aspnet_regiis.exe utility:
1. Click Start, and then click Run.
2. In the Open text box, type cmd, and then press ENTER.
3. At the command prompt, type the following, and then press ENTER:
"%windir%\Microsoft.NET\Fr amework\ve rsion\aspn et_regiis. exe" -i
In this path, version represents the version number of the .NET Framework that you installed on your server. You must replace this placeholder with the actual version number when you ty
try that
To fix IIS mappings for ASP.NET, run the Aspnet_regiis.exe utility:
1. Click Start, and then click Run.
2. In the Open text box, type cmd, and then press ENTER.
3. At the command prompt, type the following, and then press ENTER:
"%windir%\Microsoft.NET\Fr
In this path, version represents the version number of the .NET Framework that you installed on your server. You must replace this placeholder with the actual version number when you ty
try that
ASKER
I ran it, but it still not work.
C:\Inetpub\wwwroot\aspnet_ client do u have the
aspnet_client folder in the IIS virtual folder...
try restarting the IIS or the computer
aspnet_client folder in the IIS virtual folder...
try restarting the IIS or the computer
ASKER
I just have Visual Studio.NET installed in my personal computer, not on the web server. What should I do?
You can try run
aspnet_regiis -c
to repair client scripts on the SERVER.
aspnet_regiis -c
to repair client scripts on the SERVER.
ASKER
I ran this in my local computer command prompt
"%windir%\Microsoft.NET\Fr amework\v1 .1.4322\as pnet_regii s.exe" -c
and received this
An error has occurred <0x80070003>
"%windir%\Microsoft.NET\Fr
and received this
An error has occurred <0x80070003>
strange.
By the way, did you use IE to view the page?
By the way, did you use IE to view the page?
ASKER
Yes.
The funny thing is it works with the intranet site. This is the second Net web project I created. The first one is on the intranet, this is on the internet.
The funny thing is it works with the intranet site. This is the second Net web project I created. The first one is on the intranet, this is on the internet.
ASKER
I check my web server, I saw the folder aspnet_client there. So what is wrong now. Please help. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah, it works now. THANKS A MILLION!
may ushoudl try running asp_regiis