onclick

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike piano

    #1

    onclick

    With html buttons, I can say onclick="MyFunc tion();" and
    it calls a JavaScript function called "MyFunction ", but
    with the Web Controls buttons, OnClick="MyFunc tion();"
    produces an error:

    Compiler Error Message: BC30456: 'MyFunction' is not a
    member of 'ASP.wfNI206AE_ aspx'. I'm trying to research wh
    these controls can't find the javascript function. Both
    the control and the javascript function are contained
    within the same set of <form></form> tags.

    Anyone know anything about this?

  • Angela

    #2
    onclick

    did you write a JavaScript function MyFunction()?



    [color=blue]
    >-----Original Message-----
    >With html buttons, I can say onclick="MyFunc tion();" and
    >it calls a JavaScript function called "MyFunction ", but
    >with the Web Controls buttons, OnClick="MyFunc tion();"
    >produces an error:
    >
    >Compiler Error Message: BC30456: 'MyFunction' is not a
    >member of 'ASP.wfNI206AE_ aspx'. I'm trying to research[/color]
    wh[color=blue]
    >these controls can't find the javascript function. Both
    >the control and the javascript function are contained
    >within the same set of <form></form> tags.
    >
    >Anyone know anything about this?
    >
    >.
    >[/color]

    Comment

    • Dune

      #3
      onclick

      Not sure if this explanation is accurate, but this is how
      i understand it...

      With the html buttons, the OnClick works with the
      javascript because the OnClick handles the click on the
      client-side...if you look at the event handler for a html
      button in your code-behind, you'll notice that the event
      handled is actually ServerClick - the click is handled
      server-side.

      If you want to use a javascrupt function with the OnClick
      for a web server button, you can either set it as a
      property of the button in the aspx page like this:

      OnClick="javasc ript:MyFunction ();"

      Or you can add the javascript function to the web server
      button's OnClick event in the code-behind like this
      (working in vb):

      btnName.Attribu tes.Add("onClic k", "MyFunction();" )

      [color=blue]
      >-----Original Message-----
      >With html buttons, I can say onclick="MyFunc tion();" and
      >it calls a JavaScript function called "MyFunction ", but
      >with the Web Controls buttons, OnClick="MyFunc tion();"
      >produces an error:
      >
      >Compiler Error Message: BC30456: 'MyFunction' is not a
      >member of 'ASP.wfNI206AE_ aspx'. I'm trying to research[/color]
      wh[color=blue]
      >these controls can't find the javascript function. Both
      >the control and the javascript function are contained
      >within the same set of <form></form> tags.
      >
      >Anyone know anything about this?
      >
      >.
      >[/color]

      Comment

      Working...