• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

.net event handling

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    .net event handling

    i have web user controls (.ascx) that i load dynamically into a .aspx file. how do i track events (eg simple onClick) in the loaded control? answers (if any) pref in c#.

    #2
    got it,

    i think...
    a cunning mix of pre-render, reloading the control and adding it to the placeholder collection and setting a reference to the event handler in InitializeComponent...
    brill, i think...the event firing order is not what i thought.

    Comment


      #3
      Re: got it,

      Glad to see we could help!

      Comment


        #4
        there's more...

        anybody got a working example of passing a custom event from a dynamically loaded user control up to the host .aspx file? i set up the delegate, the handler, set instances, fire the event, have a subscriber set up, but zilch. i always seem to get a null reference for the event when i pass it to the firing method.

        Comment


          #5
          Re: there's more...

          ScotsPine, why would you want to create such an abdomination of a web page? Web pages should use standard mechanisms without bastardisation. Therefore the only onClick event you should be using is JavaScript's, unless you embed ActiveX or Java ******.

          You should reflect on your action - the page you building may work but it will not be like pages people used to and as the result you might have usability issues.

          Comment


            #6
            i don't think

            you understand .net if you say that atw. the .net model is entirely event driven. javascript is old technology. any client-side issues are taken care of by the runtime by detecting the browser and coding appropriately. the page i'm working on is very standard .net stuff, - apart from raising custom events in dynamically loaded controls! :rolleyes

            Comment


              #7
              Re: i don't think

              .net is NOT bastardised web page.

              >any client-side issues are taken care of by the runtime by
              >detecting the browser and coding appropriately.

              yeah right, IE is over 99% of all web users, dont tell me that you care about 1% of Netscape'ers - if you did then you should not have been using .NEt. Detect all you want on SERVER side - UserAgent is passed as part of web page request. No need to do any crappy CLIENT side coding.

              i make my money on analytics and i can tell you that poor website costs a lot of money and using .net events and other bastardised pages (that includes javascript) is the road to hell.

              i've done .aspx pages using .net and I did not need to use any events - there is a simpler solution that is expected by most web visitors that does not require events or any other crap like that.

              Repeat after me - WEB IS NOT A WINDOWS FORM!

              Comment


                #8
                i don't understand you atw -

                how then would you trap a server side event within a user control? i never mentioned using client-side code, you did! how would you trap a session end event in a dynamically loaded user control from user interaction and reload appropriate pages when that event had happened? i have used asp, vb, com, com+, mts etc etc for years. .net is entirely different. it is all compiled, event-driven managed code. there was no way you could use custom event handling in the old days to drive your website. now it is possible.

                Comment


                  #9
                  i don't think

                  you have done very much .net if these are your answers!

                  Comment


                    #10
                    Re: i don't think

                    I think you'll find there are a lot of ASP.NET developers who are simply writing old style ASP pages and are not using the server control technology (i.e. they are writing JavaScript and server side code to spew out HTML).

                    What you are doing ScotsPine is *proper* ASP.NET development.

                    What Atw is talking about is the *old* technology approach to web dev, applicable to classic ASP, Perl, PHP etc.

                    Which will win the most friends, I don't know.

                    Comment

                    Working...
                    X