469,927 Members | 1,724 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

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 1549
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Joe Mowry | last post: by
13 posts views Thread by Samantha Smit | last post: by
13 posts views Thread by Mtk | last post: by
3 posts views Thread by Jeff | last post: by
6 posts views Thread by Jim M | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.