473,399 Members | 2,774 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,399 software developers and data experts.

Simple question - C# includes

Im guessing this is a really simple question. How do server-side
includes work in c#? For example, I have a swtich statement and
depending on its output, I want to include different files. I had the
code in VB and then tried to port it over but I just cant find the C#
file comand.

switch(kind)
{
case "parts":
page += "manuals_parts.aspx";
break;
case "service":
page += "manuals_service.aspx";
break;
case "operator":
page += "manuals_operator.aspx";
break;
case "specs":
page += "manuals_specs.aspx";
break;
case "schematics":
page += "manuals_schematics.aspx";
break;
default :
page += "manuals_main.aspx";
break;
}

*** VB would then say Response.Writefile(page)

what is it in c#?

Oct 4 '07 #1
2 1614
You should create a Web User Control then dynamically load them depending on
the switch.

I would use a PlaceHolder control then do something like this:

Control myControl;

switch(kind)

{

case "parts":

myControl = LoadControl("MyPartsControl.ascx");

break;

case "service":

myControl = LoadControl("MyServiceControl.ascx");

break;

}

myPlaceHolderControl.Controls.Add(myControl);

Regards,

Brian K. Williams


"porter" <le*****@gmail.comwrote in message
news:11**********************@n39g2000hsh.googlegr oups.com...
Im guessing this is a really simple question. How do server-side
includes work in c#? For example, I have a swtich statement and
depending on its output, I want to include different files. I had the
code in VB and then tried to port it over but I just cant find the C#
file comand.

switch(kind)
{
case "parts":
page += "manuals_parts.aspx";
break;
case "service":
page += "manuals_service.aspx";
break;
case "operator":
page += "manuals_operator.aspx";
break;
case "specs":
page += "manuals_specs.aspx";
break;
case "schematics":
page += "manuals_schematics.aspx";
break;
default :
page += "manuals_main.aspx";
break;
}

*** VB would then say Response.Writefile(page)

what is it in c#?

Oct 4 '07 #2
c# is case sensitive try:

Response.WriteFile(page);

-- bruce (sqlwork.com)
porter wrote:
Im guessing this is a really simple question. How do server-side
includes work in c#? For example, I have a swtich statement and
depending on its output, I want to include different files. I had the
code in VB and then tried to port it over but I just cant find the C#
file comand.

switch(kind)
{
case "parts":
page += "manuals_parts.aspx";
break;
case "service":
page += "manuals_service.aspx";
break;
case "operator":
page += "manuals_operator.aspx";
break;
case "specs":
page += "manuals_specs.aspx";
break;
case "schematics":
page += "manuals_schematics.aspx";
break;
default :
page += "manuals_main.aspx";
break;
}

*** VB would then say Response.Writefile(page)

what is it in c#?
Oct 4 '07 #3

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

Similar topics

2
by: Joe Mowry | last post by:
First off, I'm posting this question for a friend that doesn't have access to the news groups. Problem: Using PHP as the base and has several PHP < includes > for various functions, all this...
13
by: Samantha Smit | last post by:
Hi, I am trying to create a simple asp page that has one command button that updates a database. The URL of the page is like this: http://MyServer.com/Update.asp?UserName=Tom My asp code is...
4
by: Patrick | last post by:
I have an ASP site with about 50 ASP files, all of which are currently including a common "includes.asp" file near the top of the file, responsible for generating the <HEAD/> section of the HTML ...
13
by: Mtk | last post by:
Hi! Why does the following, simple, example produce such errors? I know it has to do with the two header files including each other and (moreover) the usage of the classes One and Two in the...
3
by: Jeff | last post by:
I have an asp page. Now I know this is sortof OT, but I am not sure of the forum to get an answer. I have an include on this asp page <!-- #include file=\forum\includes\consts-inc.asp --> ...
6
by: Jim M | last post by:
I've been distributing a fairly mature, very specific MS Access application to end users in small offices of colleges for several years now. This is a part-time venture and low volume operation-...
1
by: KShapiro | last post by:
Hi All, I am trying to assist my wife, by making a simple menu system for the website. The web page is a .php4 file and does an include of the navigation file. Before it includes that file at...
3
by: Steven Edison | last post by:
I have a split container on my form, from within one of them I wish to reach the main from of the app. I'm having problems with the headers and namespaces. I want something like this: ...
1
by: Gaz35 | last post by:
Hi, I have been asked to add to some old ASP code , im more of a PHP/ASP.Net man so im a bit confused how to do this in ASP. all that is needed is an attachment section to the old form so that...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.