Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Create Own new event Handlers ASP.Net

Create Own new event Handlers ASP.Net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dsrao
    wrote on last edited by
    #1

    Hi, I have to add new event handler for my custom control.how to create own event to my control.Like Click ,Mouseover events .Please help me anybody. Thanks Srini DSR Software Engineer Kualalumpur Malaysia. Phone# 601-769-20477 Office #603-228-40073

    J D 2 Replies Last reply
    0
    • D dsrao

      Hi, I have to add new event handler for my custom control.how to create own event to my control.Like Click ,Mouseover events .Please help me anybody. Thanks Srini DSR Software Engineer Kualalumpur Malaysia. Phone# 601-769-20477 Office #603-228-40073

      J Offline
      J Offline
      Javier Lozano
      wrote on last edited by
      #2

      Check out this tutorial[^] that shows you how to author your own custom/composite controls. ~Javier Lozano (blog)

      1 Reply Last reply
      0
      • D dsrao

        Hi, I have to add new event handler for my custom control.how to create own event to my control.Like Click ,Mouseover events .Please help me anybody. Thanks Srini DSR Software Engineer Kualalumpur Malaysia. Phone# 601-769-20477 Office #603-228-40073

        D Offline
        D Offline
        Dave Bacher
        wrote on last edited by
        #3

        Web pages consist of two parts. There is a part on the client in (D)(X)HTML, and there is a part on the server (the ASP.NET page and codebehind). Anything that happens in the ASP.NET code behind (or inline server side elements, such as <% %>) requires a post back. Post backs are slow (it's like if you typed a new address and hit enter, it has to go talk to the server), so you don't want to generate them if you can avoid it. So it's very likely what you are wanting to do needs CSS2, DHTML and/or JavaScript. If you go and do a search in Google for DHTML and JavaScript, you'll find some starting points. CodeProject has some nice articles. You can register a block of client script with the RegisterClientScriptBlock method of the Page object. This creates a block of script with a unique identifier identifying it, so if it's called for the same script a few times, you only get one copy of the code. You can register a post-back event handler using Page.GetPostBackEventReference. It creates the necessary code, and returns a string containing the code to cause a post back to the server. In some cases, the string it returns might not be what you want, you might want to generate other code (it posts back a single string parameter -- if that's not what you want, you have to write JavaScript to get what you want into the parameter). The events you can hook are determined by the specific client browser and the element you are placing a hook on. You need to look at a DHTML reference to see what events are available, and what they are named. Note if you need to run on non-Microsoft browsers, you'll need to look up what events are common, and what they are named. Standards compliant browsers sometimes use different names from Microsoft's, and sometimes require different code from Microsoft's. Typically, the code will look something like this: You can do this either from code behind or from the ASP.NET page itself, depending on if you need to dynamically generate the JavaScript or not. Additionally, on standards compliant browsers (or on IE 6 with ie7.sf.net loaded), for many effects, you don't need to use JavaScript at all. Using CSS2, you can implement mouse overs where a graphic changes, for example. The benefit to using CSS2 is that it is a standard, and supported natively by the browser, so you have less maintenence.

        D 1 Reply Last reply
        0
        • D Dave Bacher

          Web pages consist of two parts. There is a part on the client in (D)(X)HTML, and there is a part on the server (the ASP.NET page and codebehind). Anything that happens in the ASP.NET code behind (or inline server side elements, such as <% %>) requires a post back. Post backs are slow (it's like if you typed a new address and hit enter, it has to go talk to the server), so you don't want to generate them if you can avoid it. So it's very likely what you are wanting to do needs CSS2, DHTML and/or JavaScript. If you go and do a search in Google for DHTML and JavaScript, you'll find some starting points. CodeProject has some nice articles. You can register a block of client script with the RegisterClientScriptBlock method of the Page object. This creates a block of script with a unique identifier identifying it, so if it's called for the same script a few times, you only get one copy of the code. You can register a post-back event handler using Page.GetPostBackEventReference. It creates the necessary code, and returns a string containing the code to cause a post back to the server. In some cases, the string it returns might not be what you want, you might want to generate other code (it posts back a single string parameter -- if that's not what you want, you have to write JavaScript to get what you want into the parameter). The events you can hook are determined by the specific client browser and the element you are placing a hook on. You need to look at a DHTML reference to see what events are available, and what they are named. Note if you need to run on non-Microsoft browsers, you'll need to look up what events are common, and what they are named. Standards compliant browsers sometimes use different names from Microsoft's, and sometimes require different code from Microsoft's. Typically, the code will look something like this: You can do this either from code behind or from the ASP.NET page itself, depending on if you need to dynamically generate the JavaScript or not. Additionally, on standards compliant browsers (or on IE 6 with ie7.sf.net loaded), for many effects, you don't need to use JavaScript at all. Using CSS2, you can implement mouse overs where a graphic changes, for example. The benefit to using CSS2 is that it is a standard, and supported natively by the browser, so you have less maintenence.

          D Offline
          D Offline
          dsrao
          wrote on last edited by
          #4

          Thank you.. Actually i want implement charts like Bar,Pie in my current project.I got blong.dll and source code from Codeproject article: http://www.codeproject.com/aspnet/webchart.asp" .If user clicks particualr dimension i want fire events based on the value. Please let me know ASAP. Thanks & Regards Rao

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups