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. Access EventArgs from PageLoad

Access EventArgs from PageLoad

Scheduled Pinned Locked Moved ASP.NET
helpquestion
6 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.
  • M Offline
    M Offline
    Mircea Grelus
    wrote on last edited by
    #1

    Is there any way to access the System.EventArgs of a Click event from the Page_Load event? My problem is as follows: I have a page which is constructed of usercontrols (ascx), so I have a menu usercontrol, another navigation control and a main content control. The problem is when I click on a menu item (in order to navigate to another page), the Page_Load event is fired for every usercontrol in the page before the ItemClick event is fired for the menu control, and as a result the main content page loads again, and only after that when the click event fires, the user is redirected to a new page. This basically introduces an unnecessary processing of the page I'm navigation away from. I have hacked my way by interpreting who has postbacked the page in the Page_Load of the menu control, but I need access to the EventArgs of that method. I've managed to get the ID of the element sent as event argument using Page.Request.Params["__EVENTARGUMENT"] but I need the whole object. Any ideas?

    Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy

    S G 2 Replies Last reply
    0
    • M Mircea Grelus

      Is there any way to access the System.EventArgs of a Click event from the Page_Load event? My problem is as follows: I have a page which is constructed of usercontrols (ascx), so I have a menu usercontrol, another navigation control and a main content control. The problem is when I click on a menu item (in order to navigate to another page), the Page_Load event is fired for every usercontrol in the page before the ItemClick event is fired for the menu control, and as a result the main content page loads again, and only after that when the click event fires, the user is redirected to a new page. This basically introduces an unnecessary processing of the page I'm navigation away from. I have hacked my way by interpreting who has postbacked the page in the Page_Load of the menu control, but I need access to the EventArgs of that method. I've managed to get the ID of the element sent as event argument using Page.Request.Params["__EVENTARGUMENT"] but I need the whole object. Any ideas?

      Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      Hope this will help you to solve your problem.

      SSK. Anyone who says sunshine brings happiness has never danced in the rain.

      M 1 Reply Last reply
      0
      • S Sathesh Sakthivel

        Hope this will help you to solve your problem.

        SSK. Anyone who says sunshine brings happiness has never danced in the rain.

        M Offline
        M Offline
        Mircea Grelus
        wrote on last edited by
        #3

        Thanks, but I don't see how ViewState could help me. I'm not trying to persist a state. I just want to get a reference to the EventArgs of processing events (Click in my case), from the Page_Load method (which fires before the processing events).

        Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy

        S 1 Reply Last reply
        0
        • M Mircea Grelus

          Thanks, but I don't see how ViewState could help me. I'm not trying to persist a state. I just want to get a reference to the EventArgs of processing events (Click in my case), from the Page_Load method (which fires before the processing events).

          Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy

          S Offline
          S Offline
          Sathesh Sakthivel
          wrote on last edited by
          #4

          Ok i will try to work it out your problem and get back to you in few minutes.

          SSK. Anyone who says sunshine brings happiness has never danced in the rain.

          1 Reply Last reply
          0
          • M Mircea Grelus

            Is there any way to access the System.EventArgs of a Click event from the Page_Load event? My problem is as follows: I have a page which is constructed of usercontrols (ascx), so I have a menu usercontrol, another navigation control and a main content control. The problem is when I click on a menu item (in order to navigate to another page), the Page_Load event is fired for every usercontrol in the page before the ItemClick event is fired for the menu control, and as a result the main content page loads again, and only after that when the click event fires, the user is redirected to a new page. This basically introduces an unnecessary processing of the page I'm navigation away from. I have hacked my way by interpreting who has postbacked the page in the Page_Load of the menu control, but I need access to the EventArgs of that method. I've managed to get the ID of the element sent as event argument using Page.Request.Params["__EVENTARGUMENT"] but I need the whole object. Any ideas?

            Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            The event arguments for the event doesn't exist when the Page_Load method is run. They are created when the event handler for the click event is called. What data from the event arguments is it that you need?

            Experience is the sum of all the mistakes you have done.

            M 1 Reply Last reply
            0
            • G Guffa

              The event arguments for the event doesn't exist when the Page_Load method is run. They are created when the event handler for the click event is called. What data from the event arguments is it that you need?

              Experience is the sum of all the mistakes you have done.

              M Offline
              M Offline
              Mircea Grelus
              wrote on last edited by
              #6

              The menu is a Telerik usercontrol called radMenu. The items of the menu are objects that contain different properties (on the serverside) and are rendered as tables after the page loads. When clicking on a menu item a Javascript like __doPostBack(_telerikControlID_,_itemID_) is called. where itemID is the ID of the table that contains the items. What I need to access is a property of that menu item clicked. The itemID isn't helping me and the needed property is not rendred in the page. So I need to somehow recreate the objects based on their IDs like the framework does. Do you have any idea how I could do that?

              Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy

              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