Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2004

Tip: Looking for answers? Try searching our database.

Extracting runat server objects from aspx

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ryan - 20 Dec 2004 12:49 GMT
Hi All,

I'm trying to programmatically extract all of the objects in a .aspx
page that can be seen from code. This is basically anything that has an
id and runat=server element. So far I've managed to load the assembly
into my code and list all of the page classes, the problem is that I
cannot get lower down than the page object.

This is from another application instance, so I cannot cycle through
the page.controls recursively as it does not exist in the code that I
am running from.

Any code samples/hints would be greatly appreciated. FYI this is for an
app that loads a .net dll dynamically and then creates a resource file
containing all of the user displayable elements (HTML selects, buttons,
images etc) on every asp.net page. This resource file can then be
localised to German, French etc by someone else (not me).
Thanks in advance for any hints

Ryan
John Saunders - 20 Dec 2004 16:04 GMT
> Hi All,
>
[quoted text clipped - 13 lines]
> images etc) on every asp.net page. This resource file can then be
> localised to German, French etc by someone else (not me).

You're not going to be able to do this by Reflection. You're actually going
to have to execute the page in order to get the controls created.  What
about pages which don't use codebehind, for instance? Those controls never
get instantiated until the page is parsed and executed.

Microsoft experimented with a technology called the Enterprise Localization
Toolkit. You might look that up for some ideas. However, it didn't
automatically find all controls. I don't think that what you want to do is
possible.

John Saunders

P.S. You might do better in the microsoft.public.dotnet.framework.aspnet
newsgroup
Ryan - 21 Dec 2004 11:56 GMT
Thanks,

Tried the MS stuff, it nearly does it to the point of being very
frustrating. Lots of code missing and the docs are a bit poor. I bet it
is another 2.0 thing that we'll have to wait for.
cecil - 21 Dec 2004 22:07 GMT
Ryan,
You could use regex and parse the actual aspx files.  Would this
approach work for you?

Cecil Howell MCSD, MCAD.Net, MCT

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.