Link to home
Start Free TrialLog in
Avatar of CochiseCounty
CochiseCountyFlag for United States of America

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.SqlClient" %>

<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">&nbsp;<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></FONT></FONT></TD>
<TD>
<asp:TextBox ID="txtUserName" MaxLength="10" Runat="Server"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="txtUserName" Text="The Username field is missing." Runat="server"></asp:RequiredFieldValidator>
<FONT face="Arial" size="2"></FONT>
</TD>
</TR>
<TR>
<TD><FONT face="Arial"><FONT size="2"><STRONG>Password:<FONT color="#cc0033">*</FONT></STRONG></FONT></FONT></TD>
<TD>
<asp:TextBox ID="txtPassword" MaxLength="10" Runat="Server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="txtPassword" Text="The password field is missing." Runat="server"></asp:RequiredFieldValidator><FONT face="Arial" size="2"></FONT>
</TD>
</TR>
<TR>
<TD colspan="4">&nbsp;<BR>
<asp:button
onclick="btnSubmit_Click"
text="Submit Form!" runat="server" ID="Button1"/>
</TD>
</TR>
</TABLE>
</form>
</body>
</HTML>
Avatar of praneetha
praneetha

so when u remove req field validtaor it works..

may ushoudl try running asp_regiis
Avatar of CochiseCounty

ASKER

Yes, when I remove the field validator, the page works fine.

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\Framework\version\aspnet_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
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
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.
I ran this in my local computer command prompt

"%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe" -c

and received this

An error has occurred <0x80070003>
strange.

By the way, did you use IE to view the page?
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.
I check my web server, I saw the folder aspnet_client there. So what is wrong now. Please help. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of praneetha
praneetha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yeah, it works now. THANKS A MILLION!