using reflection in codebehind

P

PJ6

This kind of threw me, using Me.GetType in a page's codebehind returns a
page type and not the type of the actual vb class. Is there a way to
retreive the vb class type during execution?

Also, is there a way, from the vb-declared type, to retrieve the
ASP-declared type?

Thanks,
Paul
 
S

S. Justin Gengo

Paul,

Check out a Context Page Name component I have freely available on my
website.

It does what you want. The full source code is downloadable for free. Just
go to http://www.aboutfortunate.com, click the "Code Library" link at the
top of the page and then click the "Context Page Name" button on the left.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
B

Brock Allen

Me.GetType will return the concrete type at runtime. Your class is the base
class of the page object. Use this instead:

Dim t As Type = GetType(YourCodeBehindClassName)
 
P

PJ6

D'oh, I should have guessed.

Thanks!
Paul

Brock Allen said:
Me.GetType will return the concrete type at runtime. Your class is the
base class of the page object. Use this instead:

Dim t As Type = GetType(YourCodeBehindClassName)
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top