Professional Web Applications Themes

Calling a function in codebehind from the html side of the aspx? - ASP.NET General

I read from some book that you can actually on any tag in the html page put a onClick or something and assign it with the sub/function name that is in the codebehind. I tried but it say name undefined. I am trying to make a rollover effect using codebehind. I have a <a> tag that onmouseover will call a sub in codebehind to change a <asp:image> image url. How come i can see a lot of "on" events of the <a> in the html side but when i declare it in the codebehind and i can only access only ...

  1. #1

    Default Calling a function in codebehind from the html side of the aspx?

    I read from some book that you can actually on any tag in the html page put
    a onClick or something and assign it with the sub/function name that is in
    the codebehind. I tried but it say name undefined.

    I am trying to make a rollover effect using codebehind. I have a <a> tag
    that onmouseover will call a sub in codebehind to change a <asp:image> image
    url.

    How come i can see a lot of "on" events of the <a> in the html side but when
    i declare it in the codebehind and i can only access only a few of them?

    thanks.


    exshige Guest

  2. #2

    Default Re: Calling a function in codebehind from the html side of the aspx?

    It seems you misinterpreted the book that you read.

    You don't want the page to post back every time the mouse moves over an
    image. The performance would be terrible.

    You want to call client side code such as javascript to do this, not your
    code behind. And yes, you would use the (client side) onMouseOver event to
    call your javascript function.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "exshige" <exshigeyahoo.no.spam.com> wrote in message
    news:3f0a3df7$1_1news.tm.net.my...
    > I read from some book that you can actually on any tag in the html page
    put
    > a onClick or something and assign it with the sub/function name that is in
    > the codebehind. I tried but it say name undefined.
    >
    > I am trying to make a rollover effect using codebehind. I have a <a> tag
    > that onmouseover will call a sub in codebehind to change a <asp:image>
    image
    > url.
    >
    > How come i can see a lot of "on" events of the <a> in the html side but
    when
    > i declare it in the codebehind and i can only access only a few of them?
    >
    > thanks.
    >
    >

    Steve C. Orr, MCSD Guest

  3. #3

    Default Re: Calling a function in codebehind from the html side of the aspx?

    hmm.. thanks.. i actually did thought of using js to do that like the old
    days.. but again, i thought maybe i could create something that is totally
    vb based... i tried to put the code from codebehind together with the html
    page under the script tag but it won't let me reference to other controls on
    the page inside that sub or function.

    i get what u mean.. well, i guess i have no choice but to use js.

    thanks.


    "Steve C. Orr, MCSD" <SteveOrr.net> wrote in message
    news:#XsllARRDHA.2676TK2MSFTNGP10.phx.gbl...
    > It seems you misinterpreted the book that you read.
    >
    > You don't want the page to post back every time the mouse moves over an
    > image. The performance would be terrible.
    >
    > You want to call client side code such as javascript to do this, not your
    > code behind. And yes, you would use the (client side) onMouseOver event
    to
    > call your javascript function.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD
    > [url]http://Steve.Orr.net[/url]
    >
    >
    > "exshige" <exshigeyahoo.no.spam.com> wrote in message
    > news:3f0a3df7$1_1news.tm.net.my...
    > > I read from some book that you can actually on any tag in the html page
    > put
    > > a onClick or something and assign it with the sub/function name that is
    in
    > > the codebehind. I tried but it say name undefined.
    > >
    > > I am trying to make a rollover effect using codebehind. I have a <a> tag
    > > that onmouseover will call a sub in codebehind to change a <asp:image>
    > image
    > > url.
    > >
    > > How come i can see a lot of "on" events of the <a> in the html side but
    > when
    > > i declare it in the codebehind and i can only access only a few of
    them?
    > >
    > > thanks.
    > >
    > >
    >
    >

    exshige Guest

Similar Threads

  1. Calling an Ascx from w/i Aspx codebehind
    By SABmore in forum ASP.NET Building Controls
    Replies: 1
    Last Post: January 2nd, 08:06 PM
  2. Reach UserControl from ASPX codebehind?
    By Özden Irmak in forum ASP.NET Building Controls
    Replies: 3
    Last Post: June 30th, 02:46 PM
  3. Help! Having trouble calling codebehind function from repeater results!
    By Kent P. Iler in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: March 7th, 11:04 PM
  4. Controls with a client side onLoad function or seting a cursor server side
    By Geoff Davis in forum ASP.NET Building Controls
    Replies: 3
    Last Post: January 15th, 03:54 AM
  5. Client side validation in aspx page
    By Paul in forum ASP.NET General
    Replies: 2
    Last Post: August 7th, 03:33 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139