Scripts Questions

Results 1 to 2 of 2

Thread: Scripts Questions

  1. #1
    Join Date
    Dec 1969

    Default Scripts Questions

    Hello - I have not written much in the way of "client scripts" and i have a few very general questions about them.<BR><BR>If you are VS.Net, you place "all" of your code in the codebehind page. When you write something which will not be executed on the server, but is client script, must you place this code in the "aspx" page or can you place it on the "aspx.vb" page?<BR><BR>Any script that I do write in either of C# will be translated into java code if needed?<BR><BR>I am trying out using my first "CustomValidator" with client script and my client script is failing. I am looking at a C# and a java example and both of them show a pattern which looks like the following "Fuction functionName (sender, Args)", yet when I attempt to replicate this in VB.Net <BR>I get an error of "Microsoft JScript runtime error: Object expected" amd it highlights this instruction, which is the function signature "ValidateCustNumberValue2(val, args)". Here is my function.<BR><BR>Public Sub ValidateCustNumberValue2(ByVal sender As Object, ByVal args As ServerValidateEventArgs)<BR> If IsNumeric(txtCustNumber.Text) Then<BR> args.isvalid = true<BR> else<BR> args.isvalid = false<BR> endif<BR>end function<BR><BR>What wrong with the signature of the function or what am I doing wrong?

  2. #2

    Default RE: Scripts Questions

    It will be easier to just have your custom validator do server only validation EnableClientScript=false.<BR><BR>Otherwise, you will need to provide a client-side javascript function.<BR><BR>To see how your client-side function will be called, look at /aspnet_client/system_web/1_0_3705_288/WebUIValidation.js

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts