avoid nested function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cipcip

    avoid nested function

    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%>f older/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:hyper link....

  • Chris Fulstow

    #2
    Re: avoid nested function

    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

    Comment

    Working...