getting the current page from inside a web control

M

musosdev

Hi

I have a class on my Intranet site that provides me with a crash popup type
page, and sends me an email containing bug information, etc.

This works fine, from any page I can call my class with an error code and a
reference to the current System.Web.UI.Page, like so...

ACR crash = new ACR("error_code", this);

The overridden ACR function is defined as...

public ACR(string e, System.Web.UI.Page this)

The problem comes when I try and call this from a WebControl inside another
page. Obviously the webcontrol isnt a System...Page, so it won't compile.

When I'm in the webcontrol, how can I pass the current System.Web.UI.Page
that the control is residing on?

Thanks!


Dan
 
W

Walter Wang [MSFT]

Hi Dan,

Every control has a property called Page which will return the page
instance that its on. The Page is itself inherited from Control. Therefore
I suggest you use:

public ACR(string e, Control ctl)
{
Page p = ctl.Page;
...


Let me know if this answers your question. Thanks.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Walter Wang [MSFT]

Hi Dan,

Just want to make sure you've seen my reply, would you please let me know
the status of this post? Thanks!

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,216
Latest member
topweb3twitterchannels

Latest Threads

Top