how to include aspx without directive?

F

Franz

Hi,

I would like to include a aspx file inside a script-block, however, I don't
want to include that file by <!-- #include virtual="whateverfile" -->. How
can I do it?

Thanks.
Franz
 
G

Guest

Franz,
Normally in ASP.NET the "include" function is performed with UserControls
(ascx). Perhaps if you could be more specific about what you mean by "include
an aspx file inside a script-block"? What is the goal here?
Peter
 
F

Franz

Peter,

I have to include a aspx file (a menu) inside a normal web page. However,
the menu is only included under some conditions.

<%
if (/* some condition */) {
%>
<!-- #include virtual="menu.aspx" -->
<%
}
%>

I want to make the above to the following.

<%
if (/* some condition */) {
Something.Include("Menu.aspx");
}
%>

Franz
 
P

Peter Rilling

I would just create a user control for the menu (.ascx) and then disable the
control (visible = false) when the condition is not met.
 
F

Franz

Thanks all of you.

Juan T. Llibre said:
Franz,

Like Peter suggested, convert your menu.aspx file to a user control
(menu.ascx).
Then, you'll be able to include it real easily.

Here's a tutorial which shows how to convert a web form into a user
control :

http://msdn2.microsoft.com/en-us/library/2x6sx01c.aspx

Follow the directions in it and you'll be home free.




Juan T. Llibre
ASP.NET MVP
ASPNETFAQ.COM : http://www.aspnetfaq.com
==================================
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top