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. How to define event for a page? [modified]

How to define event for a page? [modified]

Scheduled Pinned Locked Moved ASP.NET
questiondesigntutorial
2 Posts 2 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.
  • I Offline
    I Offline
    immori
    wrote on last edited by
    #1

    Hi my dears, I`ve written a Web UserControl which has a timer with interval and elapsed event. and I want to raise an event in Timer elapsed method. then I defined a delegate and an event in my Web UserControl . Now I should register this event to my default.aspx page and catch the raised event from my web userControl in a method in my default.aspx page. But I dont know how to register event in aspx page! the code I used is : //my UserControl named reminder.ascx public delegate void myDelegate(string s); public static myDelegate myEvevnt; protected void Page_Load(object sender, EventArgs e) { System.Timers.Timer myTimer = new System.Timers.Timer(); myTimer.Elapsed += new System.Timers.ElapsedEventHandler(myTimer_Elapsed); myTimer.Interval = 3000; myTimer.Enabled = true; } protected static void myTimer_Elapsed(object source, ElapsedEventArgs e) { myEvevnt("hhh"); } //************************************* // my default.aspx page public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { _Default.Event += new reminder.myDelegate (RecieveEvent);//my question is here.What should I write ??? } -- modified at 3:17 Wednesday 8th November, 2006

    _ 1 Reply Last reply
    0
    • I immori

      Hi my dears, I`ve written a Web UserControl which has a timer with interval and elapsed event. and I want to raise an event in Timer elapsed method. then I defined a delegate and an event in my Web UserControl . Now I should register this event to my default.aspx page and catch the raised event from my web userControl in a method in my default.aspx page. But I dont know how to register event in aspx page! the code I used is : //my UserControl named reminder.ascx public delegate void myDelegate(string s); public static myDelegate myEvevnt; protected void Page_Load(object sender, EventArgs e) { System.Timers.Timer myTimer = new System.Timers.Timer(); myTimer.Elapsed += new System.Timers.ElapsedEventHandler(myTimer_Elapsed); myTimer.Interval = 3000; myTimer.Enabled = true; } protected static void myTimer_Elapsed(object source, ElapsedEventArgs e) { myEvevnt("hhh"); } //************************************* // my default.aspx page public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { _Default.Event += new reminder.myDelegate (RecieveEvent);//my question is here.What should I write ??? } -- modified at 3:17 Wednesday 8th November, 2006

      _ Offline
      _ Offline
      _mubashir
      wrote on last edited by
      #2

      You may find THIS[^] useful. Mubashir

      Every job is a self portrait of the person who did it.

      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