J JezB Jun 17, 2004 #1 Can I programatically get a list of Pages that are part of an ASP.NET assembly ?
J John Saunders Jun 17, 2004 #2 JezB said: Can I programatically get a list of Pages that are part of an ASP.NET assembly ? Click to expand... You could use Reflection to iterate through all the classes in the assembly and then look at those which derive from System.Web.UI.Page.
JezB said: Can I programatically get a list of Pages that are part of an ASP.NET assembly ? Click to expand... You could use Reflection to iterate through all the classes in the assembly and then look at those which derive from System.Web.UI.Page.
J JezB Jun 18, 2004 #3 I could indeed, good idea. I'll give it a try. John Saunders said: You could use Reflection to iterate through all the classes in the assembly and then look at those which derive from System.Web.UI.Page. Click to expand...
I could indeed, good idea. I'll give it a try. John Saunders said: You could use Reflection to iterate through all the classes in the assembly and then look at those which derive from System.Web.UI.Page. Click to expand...
J JezB Jun 18, 2004 #4 For the record: private ArrayList GetPages(Assembly a) { ArrayList pages = new ArrayList(); foreach (Type tt in a.GetTypes()) { if (tt.BaseType.Name == "Page") pages.Add(tt.Name); } return pages; }
For the record: private ArrayList GetPages(Assembly a) { ArrayList pages = new ArrayList(); foreach (Type tt in a.GetTypes()) { if (tt.BaseType.Name == "Page") pages.Add(tt.Name); } return pages; }
J John Saunders Jun 18, 2004 #5 JezB said: For the record: private ArrayList GetPages(Assembly a) { ArrayList pages = new ArrayList(); foreach (Type tt in a.GetTypes()) { if (tt.BaseType.Name == "Page") pages.Add(tt.Name); } return pages; } Click to expand... I think that tt.IsSubClassOf(typeof(System.Web.UI.Page)) would work better. Yours will pick up my own type called "Page".
JezB said: For the record: private ArrayList GetPages(Assembly a) { ArrayList pages = new ArrayList(); foreach (Type tt in a.GetTypes()) { if (tt.BaseType.Name == "Page") pages.Add(tt.Name); } return pages; } Click to expand... I think that tt.IsSubClassOf(typeof(System.Web.UI.Page)) would work better. Yours will pick up my own type called "Page".
J JezB Jun 18, 2004 #6 Yes, that's cleaner - thank you. (IsSubclassOf) John Saunders said: I think that tt.IsSubClassOf(typeof(System.Web.UI.Page)) would work better. Yours will pick up my own type called "Page". Click to expand...
Yes, that's cleaner - thank you. (IsSubclassOf) John Saunders said: I think that tt.IsSubClassOf(typeof(System.Web.UI.Page)) would work better. Yours will pick up my own type called "Page". Click to expand...