Mertez
Mertez

Reputation: 1131

ASP.NET include behavior

What happens if I include 2 pages conditionally?

<% if(x==1) {%>
<!-- #Include virtual="/ws/inc/Master1.inc" -->
<% } else { %>
<!-- #Include virtual="/ws/inc/Master2.inc" -->
<% } %>

Which command runs first? Are both included at first, and then the if clause is evaluated, or will just one of them be included?

I want to be sure not to include the wrong page at all.

Upvotes: 0

Views: 44

Answers (1)

Aswin Ramakrishnan
Aswin Ramakrishnan

Reputation: 3213

It depends on the condition. If you don't have the statement inside a loop where you iterate through x or something similar, I think only one page will be included depending on the value of x

Upvotes: 1

Related Questions