|
-
Apr 20th, 2004, 05:48 PM
#1
Thread Starter
Frenzied Member
validation error message [*Resolved*]
Hello
I am new at learning ASP.Net. I have created a form that allows a user to enter their name and address. I have a RequiredFieldValidator on the form for each of the text boxes. Each time l run the form, l get this message box that displays this error message.
"Unable to find script library ‘/aspnet_client/system_web/1_1_4322/WebUIValidation.js’. Try placing this file manually, or reinstall by running ‘aspnet_regiis-c’"
I am not sure what this means. Could anyone explain to me how to solve this problem. Remember l am a beginner at ASP.Net.
Many thanks for your time.
Steve
Last edited by steve_rm; Apr 22nd, 2004 at 05:47 AM.
steve
-
Apr 21st, 2004, 07:04 AM
#2
Thread Starter
Frenzied Member
Hello
l have been doing some testing on my problem. And l find that when l select the enableClientScript to property to false of the requiredFieldvalation control. Then l don't get the error message when the form loads. If it is set to true then the error message will be displayed.
Can anyone not help me with the problem.
Many thanks for your time.
Steve
-
Apr 21st, 2004, 07:36 AM
#3
I wonder how many charact
The enableClientScript property simply means to run some javascript code that gets linked to the validator on the client side, if you set it to true.
The reason it doesn't error when you get it to False, is because then the Framework doesn't throw a link in the page to javascript code (which resides in your IIS directory in the asp_client folder). So then, no client-side validation occurs, and the page needs to postback to the server in order to validate.
Most people would rather you validate on the client if possible...so stick with it set to True.
Anyway, about the error:
WebUIValidation.js is the javascript file that contains the .Net validation routines.
You can get this error if this file is not where its supposed to be, and to check that, just browse to that folder specfied in the error, which in your case is C:\Inetpub\wwwroot\aspnet_client/system_web\1_1_4322\
But it is unlikely that file is corrupt or misplaced.
This error can also occur if you create the validator only when you want to validate. It seems the proper way is to always create and add the validator to the page, and then use the ENABLED property set to TRUE, when you want to validate, and FALSE when you don't.
For instance, if you are using the validator in a usercontrol or such, you would definitely be seeing this error, I know, because I spent a good 3 days figuring out how to solve it.
Need any more help... just ask..
-
Apr 21st, 2004, 09:33 AM
#4
Thread Starter
Frenzied Member
Hello nemaroller
Thanks for you help, l will check your answer now, and let you know what happens.
Many thanks.
Steve
-
Apr 21st, 2004, 09:51 AM
#5
Thread Starter
Frenzied Member
Hello
I checked the file in the specified folder and it is there.
C:\Inetpub\wwwroot\aspnet_client\system_web\1_1_4322\
If the file is corrupted, how would l replace this file with a non-corrupted one.
I also tried putting one textbox and one button, and the requiredfieldvalidator with the enable property set to false. When i press the button, the property will be set to true and validate the textbox. But this had the same problem as before, when the page starts up, it throws me this error.
I did try one last thing, and that was adding the file to the soluction in the solution explorer, but that did not work either; which l thought it would not work anyway. But had to give a try.
Hope you can still help me with this problem.
Thanks for your time.
Steve
-
Apr 21st, 2004, 10:32 AM
#6
I wonder how many charact
Post the code behind (mypage.aspx.vb) contents...
-
Apr 21st, 2004, 05:57 PM
#7
Thread Starter
Frenzied Member
Hello,
Thanks for you time in helpping me with my problem.
I was doing some research on my problem, and l found this as a solution, but it did not work for me.
This is what l did:
View | other windows | command Window.
When the command window pops-up. l type at the command prompt
>aspnet_regiis-c
I get a message saying "Command "aspnet_regiis" is not valid".
Am l doing something wrong. Please tell me.
This is the code beind that your requested.
Code:
Public Class NewCustomer
Inherits System.Web.UI.Page
Protected WithEvents lblCustomer As System.Web.UI.WebControls.Label
Protected WithEvents lblAddress As System.Web.UI.WebControls.Label
Protected WithEvents txtCustomerName As System.Web.UI.WebControls.TextBox
Protected WithEvents lblCity As System.Web.UI.WebControls.Label
Protected WithEvents lblState As System.Web.UI.WebControls.Label
Protected WithEvents txtAddress1 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAddress2 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCity As System.Web.UI.WebControls.TextBox
Protected WithEvents txtZip As System.Web.UI.WebControls.TextBox
Protected WithEvents drpState As System.Web.UI.WebControls.DropDownList
Protected WithEvents btnAddCustomer As System.Web.UI.WebControls.Button
Protected WithEvents lblConfirmation As System.Web.UI.WebControls.Label
Protected WithEvents valReqCustomerName As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents valReqAddress1 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents valReqCity As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents valReqState As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents valReqZip As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents valExpZip As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents btnCancel As System.Web.UI.WebControls.Button
Protected WithEvents lblZip As System.Web.UI.WebControls.Label
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAddress2.TextChanged
End Sub
Private Sub btnAddCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddCustomer.Click
If Page.IsValid Then
Dim s As String
s = "<font size='5'>confirmation infor:</font>" & "<BR>"
s += txtCustomerName.Text & "<BR>"
s += txtAddress1.Text & "<BR>"
If txtAddress2.Text.Length > 0 Then
s += txtAddress2.Text & "<BR>"
End If
s += txtCity.Text & ", "
s += drpState.SelectedItem.Text & " " & "<BR>"
s += txtZip.Text & "<BR>"
lblConfirmation.Text = s
Else
'Make sure that confirmation is empty
lblConfirmation.Text = ""
End If
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
lblConfirmation.Text = "cancelled"
End Sub
End Class
Hope you can solve my problem
Thanks.
Steve
Steve
-
Apr 21st, 2004, 09:44 PM
#8
Frenzied Member
You have to run aspnet_regiis from it's location. so in the command prompt just change the directory to
C:\winnt\Microsoft.NET\Framework\v1.1.4322\
then run aspnet_regiis.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Apr 22nd, 2004, 05:46 AM
#9
Thread Starter
Frenzied Member
Hello,
I did this
Start | run | cmd
cd c:\windows\microsoft.net\framework\v1.1.4322
Then type
aspnet_regiis -c
Thanks for you help. My problem has now been resolved.
I think you only learn when you have a problem like this. Least l will know next time what to do.
Many thanks
Steve
-
Apr 22nd, 2004, 07:25 AM
#10
I wonder how many charact
Yes.. funny that was your problem. In my case, it was always because I used validators in composite controls, and when I overrode the CreateChildControls method of the webcontrol class, I would only add the validator if validation was required (boolean switch). But later I found out, I needed to add it all the time, and in the OnPreRender, set to enabled or disabled.
Anyway, glad it was the easy solution for you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|