VB.Net Template Idea Suggestions

  • Thread starter Thread starter Jordan Marton
  • Start date Start date
J

Jordan Marton

Hi,

I spent the entire weekend struggling to find a suitable tempalte solution
for my site. Yes, user controls were good, but I needed one page that could
control user controls on each adn every page of my site. Unfortuentaly, I
was not able to find a solution to that, and have resorted to loading each
control on each page individually.

However, I was talking to a friend who also designs in .Net, and he came up
with this idea, and I wanted to get some opinions on it.

Instead of having 100 aspx pages and loading user controls into them, have 1
aspx page with a placeholder, and load 100 ascx pages into them when needed.
So default.aspx?page=1 would load page 1.ascx into the placeholder.
default.aspx?page=99 would load page 99 into the placeholder. Therefor, I
would only have one main page to control and keep track of, whereas all
additional pages would be loaded when needed.

Any downsides to this?

Thanks!
 
You could have a base class that renders()'s the template and derive each
page from this class and call the abstract "AddControls" method from the
base class which is overridden in the dervied class, adds the controls
specific to that page and writes out the rest of the template.

I ran into a similar issue and found a way to use oo and usercontrols to
acheive this site wide and a bit more (using some of the techniques
discussed above), but it is still under development just now.

regards,
steven
http://www.stevenlivingstone.com
http://www.venturetogether.org
 
In theory, that's a good idea, but I see a few issues:
1. How do you know to load #99 vs #98? In other words how are you going to
keep track of all of these different User controls? Maybe numbering them is
a bad idea. Maybe naming them something more "human readable" would be
better.

2. If you are not doing this in frames, a user could manipulate your URL
and go to undesirable places, or break the flow of your site.

Michael
 
Well more precisely...

www.mydomain.com/default.aspx would be the main page.

Then default.aspx?page=new_user would dynamically load the new user control
into a panel. And default.aspx?page=contact would load a contact form. It
doesn't have to be based on numbers, or pages can be by numbers and I can
use a nice big select statement to get the right page, or link the number to
a table in a database and pull the correct user control file...

If the page wasn't found, a special user control could be loaded...

Jordan
 
Well, I guess that's just as good an idea as any. I'm not sure I like the
giant select case. I suspect that's going to be a bear to maintain
depending on how many items you have in your select list.

Good luck with it man!

Michael
 
Back
Top