Register TagPrefix ?? really a good idea?

  • Thread starter Kristoffer Arfvidson
  • Start date
K

Kristoffer Arfvidson

Ok, so a new question...
Im building my page as dynamic as I can...
meaning that I have basicly one aspx page that controls everything...
so, I solved this by sending different variables to the page depending on
where i want to go, eg. www.myserver.com/gotopage.aspx?page=mainpage

ok, so, on this gotopage.aspx

I have used a lot of usercontrols to show the defferent contents of my pages
(to keep the design at one place and the code in other places...)

So to my question...
If I use:
<%@ Register TagPrefix="uc1" TagName="bottom_info_inc"
Src="blabla/bottom_info_inc.ascx" %>
<%@ Register TagPrefix="uc1" TagName="bottom2_info_inc"
Src="blabla/bottom2_info_inc.ascx" %>
<%@ Register TagPrefix="uc1" TagName="bottom3_info_inc"
Src="blabla/bottom3_info_inc.ascx" %>
<%@ Register TagPrefix="uc1" TagName="bottom4_info_inc"
Src="blabla/bottom4_info_inc.ascx" %>
<%@ Register TagPrefix="uc1" TagName="bottom5_info_inc"
Src="blabla/bottom5_info_inc.ascx" %>
<%@ Register TagPrefix="uc1" TagName="bottom6_info_inc"
Src="blabla/bottom6_info_inc.ascx" %>

and so on on my page, and then in the code control witch control should be
used, does this mean that the page is loading the content of each control
everytime a user accesses my page?
or does it only load the control when the code specifies that that control
should be viewed???

so, is it better to just use placeholders, and make the control load
entirely in the code? or???

Yours: Kristoffer
 
V

Victor Garcia Aprea [MVP]

Hi Kristoffer,

1) If you're only specifying a @ Register directive alone and no
corresponding UC tag, that will not add any overhead.
2) If you're declaratively adding all your usercontrols and you show/hide
them at runtime based on some logic, that will cause all of your controls to
be created at runtime.
3) Dynamically loading only the required user controls at runtime would be a
much better option.

Let me know if clear things up a bit,

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
 
K

Kristoffer Arfvidson

ok, I used a placeholder to show two different designs and it was alot of
different controls in each placeholder...
Each control was placed with UC tag and the placeholder was set
visible=false
however, I noticed a significiant decreese in performance, when I had a
large script in one of the placeholders...
After replacing that script with a dynamicly control = loadcontrol("") in
the code, the whole page was turned to speedy gonsales...
:)

Thanks for your reply...
Yours: Kristoffer
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top