Results 1 to 10 of 10

Thread: validation error message [*Resolved*]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    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

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331
    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
    steve

  3. #3
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    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..

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331
    Hello nemaroller

    Thanks for you help, l will check your answer now, and let you know what happens.

    Many thanks.

    Steve
    steve

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331
    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
    steve

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Post the code behind (mypage.aspx.vb) contents...

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331
    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
    steve

  8. #8
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    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

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331
    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
    steve

  10. #10
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    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
  •  



Click Here to Expand Forum to Full Width