473,687 Members | 3,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_servic e.aspx";
break;
case "operator":
page += "manuals_operat or.aspx";
break;
case "specs":
page += "manuals_specs. aspx";
break;
case "schematics ":
page += "manuals_schema tics.aspx";
break;
default :
page += "manuals_main.a spx";
break;
}

*** VB would then say Response.Writef ile(page)

what is it in c#?

Oct 4 '07 #1
2 1624
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("My PartsControl.as cx");

break;

case "service":

myControl = LoadControl("My ServiceControl. ascx");

break;

}

myPlaceHolderCo ntrol.Controls. Add(myControl);

Regards,

Brian K. Williams


"porter" <le*****@gmail. comwrote in message
news:11******** **************@ n39g2000hsh.goo glegroups.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_servic e.aspx";
break;
case "operator":
page += "manuals_operat or.aspx";
break;
case "specs":
page += "manuals_specs. aspx";
break;
case "schematics ":
page += "manuals_schema tics.aspx";
break;
default :
page += "manuals_main.a spx";
break;
}

*** VB would then say Response.Writef ile(page)

what is it in c#?

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

Response.WriteF ile(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_servic e.aspx";
break;
case "operator":
page += "manuals_operat or.aspx";
break;
case "specs":
page += "manuals_specs. aspx";
break;
case "schematics ":
page += "manuals_schema tics.aspx";
break;
default :
page += "manuals_main.a spx";
break;
}

*** VB would then say Response.Writef ile(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
1606
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 by its self works just fine. Failure occurs on adding the XML include. Here's the wierd: If all the PHP includes are removed/commented out,
13
4752
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 like this: %@ Language=VBScript %> <!--#include file="includes/openconnection.asp"-->
4
1629
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 I need to make a change for 3 of those ASP files such that some dynamic HTML is generated in the <HEAD/> section. I want those dynamic HTML to appear only for 3 specific ASP files. Is there a more elegant way other than to 1) Dim...
13
1661
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 "opposite" header file... What do I have to do to make this example work? Thanks for all the help! // * Error messages: One.h(11): error C2146: syntax error : missing ';' before identifier 't'
3
2531
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 --> now, it gives me this error: File attribute '\forum\includes\consts-inc.asp' cannot start with forward slash or back slash.
6
2033
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- this is somewhat of a hobby for me. Many of my end users are computer phobic and get little support from their IT departments. It is a split database so the datafile gets put on the file server and the 3 different front ends get put on each local...
1
1437
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 the top I have the following line of code to include my .js file. <script src="scripts/SideNav.js" language="JavaScript" type="text/javascript"></script> that is inside the <head> tag. It used to work fine with a more hard coded version of...
3
1757
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: //within right pane form ABCForm^ abcForm = (ABCForm^)Application::OpenForms; abcForm->ExecutePublicFunction();
1
1458
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 they can send pdf files to there customers. here is the orignal for code - <!--#include file="../includes/config.asp"--> <!--#include file="../includes/security_inc.asp"--> <!--#include file="../includes/sConnString.asp" --> <html> <head> <meta...
0
8590
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8527
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8784
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7621
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6453
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5806
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4321
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4543
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2214
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.