Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > BOOK: Beginning Visual C# 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual C# 2005
This is the forum to discuss the Wrox book Beginning Visual C# 2005 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White; ISBN: 9780764578472
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 8th, 2006, 03:40 PM
Authorized User
 
Join Date: Oct 2005
Location: Summerville, SC, USA.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBscript to C# .net Script

Ok,

I'm trying to recreate some code I know how to do in ASP vbscript in ASP.net C#.

Here is the code in vbscript.
Code:
<%
'Variables
Dim incfile, pg

'Define pg
pg = request.querystring("page")

'Logic for include
Select Case pg
  case "main"
     incfile = "main.asp"
  case "add"
     incfile = "add.asp"
  case "edit"
     incfile = "edit.asp"
End Select

%>
home can I recreate this is asp.net c#? Can anyone help with this?

Reply With Quote
  #2 (permalink)  
Old February 14th, 2007, 05:21 PM
Friend of Wrox
Points: 894, Level: 11
Points: 894, Level: 11 Points: 894, Level: 11 Points: 894, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: London, , United Kingdom.
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts
Default

Hi

To be honest I'm not sure if works with asp.net, but in C# the VBS bit should look like this:
Code:
string incfile = null;
string pg = Request.QueryString["page"];

switch(pg)
{
  case "main":
    incfile = "main.asp";
    break;
  case "add":
    incfile = "add.asp";
    break;
  case "edit":
    incfile = "edit.asp";
    break;
  default:
    // do something if none of the above?
    break;
}
The <%= incfile %> is the same.

Hope this helps
Phil
Reply With Quote
  #3 (permalink)  
Old February 14th, 2007, 05:35 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Did this ever work:



I thought that include files were included / combined first, before the combined page was parsed. So, when the file should be included, incfile doesn't have a value yet....

Anyway, are you familiar with User Controls in .NET? They more or less take the place of ASP includes, but offer a lot more. Additionally, when you included ASP files with mainly code, you could use the App_Code folder for shared methods.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vbscript in asp.net 2.0 ufdylan ASP.NET 2.0 Basics 3 August 14th, 2007 12:02 PM
VBScript for Client-side controls in ASP.net cJeffreywang ASP.NET 1.0 and 1.1 Professional 1 March 22nd, 2007 08:02 PM
.NET component with script.aculo.us mega ASP.NET 1.x and 2.0 Application Design 0 May 22nd, 2006 11:46 AM
Putting VBScript in an ASP.NET page jturlington ASP.NET 1.0 and 1.1 Basics 1 May 14th, 2005 09:00 PM



All times are GMT -4. The time now is 12:35 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.