Error using RegisterClientScriptBlock

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Steven K (skaper_at_troop.com)
Date: 04/14/04


Date: Wed, 14 Apr 2004 11:05:54 -0500

Hello,

I am trying to create a JavaScript function and am getting the following
error: 'jsFormValidation' is not a member of 'ASP.ciJava_aspx'.

Sub Page_Load(Sender As Object, E As EventArgs)
 Dim ctrlValidate As String = tbxSubmitter.ID
 Dim strFormValidation As String = _
  "<script language='javascript'> function jsFormValidation() {" & _
   "alert('Please enter your Name in the |Name| field.');" & _
   "document.getElementById('" & ctrlValidate & "').focus();}" & _
  "<" & "/script>"

 If(Not IsClientScriptBlockRegistered("jsFormValidation"))
  RegisterClientScriptBlock("jsFormValidation", strFormValidation)
 End If
End Sub

In the form:

    <td width="100" align="center">
    <asp:ImageButton runat="server"
     ImageURL="../../images/art_dbflash_go.jpg"
     ImageAlign="Middle"
     AlternateText="sckeels"
     OnCommand="jsFormValidation(this)"
     CommandName="ASPNET"/>
</td>


Quantcast