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#.
- 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
-
ScotsPineScotsPine
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
-
ScotsPineScotsPine
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
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. -
OrangeHopperOrangeHopper
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
-
ScotsPineScotsPine
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
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
-
AtWAtW
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
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
-
ScotsPineScotsPine
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
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! :rolleyesComment
-
AtWAtW
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
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
-
ScotsPineScotsPine
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
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
-
ScotsPineScotsPine
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
-
DimPrawnDimPrawn
- Thanks (Given):
- 0
- Thanks (Received):
- 0
- Likes (Given):
- 0
- Likes (Received):
- 0
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
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Reports of umbrella companies’ death are greatly exaggerated Nov 28 10:11
- A new hiring fraud hinges on a limited company, a passport and ‘Ade’ Nov 27 09:21
- Is an unpaid umbrella company required to pay contractors? Nov 26 09:28
- The truth of umbrella company regulation is being misconstrued Nov 25 09:23
- Labour’s plan to regulate umbrella companies: a closer look Nov 21 09:24
- When HMRC misses an FTT deadline but still wins another CJRS case Nov 20 09:20
- How 15% employer NICs will sting the umbrella company market Nov 19 09:16
- Contracting Awards 2024 hails 19 firms as best of the best Nov 18 09:13
- How to answer at interview, ‘What’s your greatest weakness?’ Nov 14 09:59
- Business Asset Disposal Relief changes in April 2025: Q&A Nov 13 09:37
Comment