avoid nested function

C

cipcip

I read on msdn that many <%=%> blocks can slows page, because they are
processed like nested functions.

Which of you have some tips to avoid using them?

One of my problem is that all links are dynamic and are in this form:

<a href="<%=url%>folder/folder/page.aspx">a link to page.aspx</a>

In each page i have abaut from 40 to 100 and more links.

There is a way to replace <%=url%> with a more efficient code?

Is it better to use a server side control for links in this
case?<asp:hyperlink....
 
C

Chris Fulstow

Hi,

Yes, in this case it might be better to use server-side web controls
like HyperLink, and set their NavigateUrl properties in the code-behind
file. You can add these dynamically to your form if your not sure how
many you'll need until runtime.

As a quick fix, you could just call a function that uses a
StringBuilder object and Response.Write() to build all your links in a
single <% %> block. That's more of a classic ASP approach though and
isn't really recommended.

HTH,
Chris
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top