473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

INCLUDE in ASPX

Hi,
I have the main page "default.aspx". I have also UserControls
"content1.ascx" and "content2.ascx". How can I write in "default.aspx" this:

if true then
show content1.ascx
else
show content2.ascx

I know I create in HTML code of "default.aspx" this line:
'<content1:content1 id="content" runat="server" />' then in the page is the
content1, but how can i manage this dynamically?
Nov 16 '05 #1
2 4930
You can set the visible property of your web control to true/false to achieve
this.

Regards,

Deepak
[I Code, therefore I am]

"Lubo¹ ©lapák" wrote:
Hi,
I have the main page "default.aspx". I have also UserControls
"content1.ascx" and "content2.ascx". How can I write in "default.aspx" this:

if true then
show content1.ascx
else
show content2.ascx

I know I create in HTML code of "default.aspx" this line:
'<content1:content1 id="content" runat="server" />' then in the page is the
content1, but how can i manage this dynamically?

Nov 16 '05 #2
In addition to Deepak's suggestion, you might look at the LoadControl and
use a placeholder. Something like this should work:

string controlName;
if (whatever)
{
controlName = "Content1.ascx";
}
else
{
controlName = "Content2.ascx";
}
this.myPlaceHolder.Controls.Add(LoadControl(contro lName));

--
Michael Giagnocavo
MVP
www.atrevido.net

"Lubo¹ ©lapák" <lu**********@centrum.cz> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...
Hi,
I have the main page "default.aspx". I have also UserControls
"content1.ascx" and "content2.ascx". How can I write in "default.aspx"
this:

if true then
show content1.ascx
else
show content2.ascx

I know I create in HTML code of "default.aspx" this line:
'<content1:content1 id="content" runat="server" />' then in the page is
the
content1, but how can i manage this dynamically?

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sameer | last post by:
I have two C# aspx pages( base.aspx and newfile.aspx 1. newfile.aspx only contain ======================= < Response.Write(Session) % =======================
2
by: Kraai | last post by:
in normal asp , and even php i could use the <!--#include file="login.aspx" --> or <!--#include virtual="login.aspx" --> to include pages in my main page without using frames! when i try...
4
by: Tom | last post by:
Hi, I installed .NET Framework Version 1.1 Redistributable Package and installed on Windows 2000 server. I created a aspx page which has some server control like asp:label, asp:textbox,...
1
by: Tom | last post by:
Hi I developed a web application and want to create the setup package msi file I created a a project and chose "Installer Web Project" I set the URL to be http://localhost:808 I chose all...
3
by: Tams TS | last post by:
Hi, am in trouble , please giv me some solution. scenario is like this; I have some asp pages and which are commerce server 2000 generated pages and going further am adding one aspx page to the...
4
by: David Jones | last post by:
I have some code repeated in many page_load methods in an ASP.NET app. I have buttons that are enabled or disbaled depending upon the state of a variable in the session. Is there a way to put that...
5
by: Franz | last post by:
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
3
by: =?Utf-8?B?QnJhbmRvbg==?= | last post by:
Hi, I have an aspx page that has the "include" code in it which includes another page that displays information. I also have an upload page that allows users to upload a simple html document...
0
by: milop | last post by:
Hello. Using VS2005, I have a solution with two web application projects. The web server for each project is IIS. I've created two virtual directories, project1 and project2, under the same...
2
by: kkshansid | last post by:
i am from asp background i am very new to asp.net environment i want to know that is there any include in asp.net as in asp so that i can include connection file which is asp.net and asp files ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.