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

ASP .NET vs. ASP

Hi all,

I have been thinking for long long time that how to create VB style class
in ASP .NET page. Below I am writing code written in normal ASP that I want
to convert to ASP .NET. I need your help for how to convert it. Please follow
the code below

----------------------------------------------------------------
[[[[[[[[[[[[[[[[[TestClass.asp]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
----------------------------------------------------------------
<%
Class TestClass

Sub JustPrint()
%>
<p>Hi this is just the test print</p>
<%
End Sub

Sub OtherPrint()
%>
<p>Hi this is another print</p>
<%
End Sub

End Class
%>

----------------------------------------------------------------
[[[[[[[[[[[[[[[[[Main.asp]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
----------------------------------------------------------------
<%@ Lauguage="VBSCRIPT"%>
<!--#include file="TestClass.asp"-->
<%
'Creating the class object
Dim clsObj
set clsObj = New TestClass

Dim requestedVal
requestedVal = Request.QueryString("type")

Select Case requestedVal
case 'other':
clsObj.OtherPrint
case else:
clsObj.TestPrint
End Select
%>
I think the above sample program is very simple. How can I convert the above
program with the same sort of flow control into ASP .NET.

My another question is "Can I still use #include directive in ASP .NET? I
want to break my HTML page into HEADER, SIDE MENU and FOOTER parts"

Your help will be appreciated
Nov 18 '05 #1
9 1225
"=?Utf-8?B?TW9oaXQgR3VwdGE=?=" <Mo********@discussions.microsoft.com>
wrote in news:82**********************************@microsof t.com:
I think the above sample program is very simple. How can I convert the
above program with the same sort of flow control into ASP .NET.
You need to change the way you think. ASP.NET is TOTALLY different from
ASP. Flow control for the most part does not exist.

A simple solution to your problem is to place a Label control on the
page.

Then, call:

If SomeCondition Then
JustPrint()
Else
OtherPrint()
End If

JustPrint() would look like:

Private Sub JustPrint()
lblTest.text = "Hi this is just the test print"
End Sub

Private OtherPrint()
lblTest.text = "Hi this is another print"
End Sub

So as you can see... ASP.NET is VERY different from ASP.

My another question is "Can I still use #include directive in ASP
.NET? I want to break my HTML page into HEADER, SIDE MENU and FOOTER
parts"


No, there is no include.

You'll need to use a templating solution like ASP masterpages.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #2
Why would somebody will then use ASP .NET instead of ASP if ASP style flow
control does not exists. I strictly wanted to have ASP style flow control.
Isn't there any other way?

Your help will be appreciated
"Lucas Tam" wrote:
"=?Utf-8?B?TW9oaXQgR3VwdGE=?=" <Mo********@discussions.microsoft.com>
wrote in news:82**********************************@microsof t.com:
I think the above sample program is very simple. How can I convert the
above program with the same sort of flow control into ASP .NET.


You need to change the way you think. ASP.NET is TOTALLY different from
ASP. Flow control for the most part does not exist.

A simple solution to your problem is to place a Label control on the
page.

Then, call:

If SomeCondition Then
JustPrint()
Else
OtherPrint()
End If

JustPrint() would look like:

Private Sub JustPrint()
lblTest.text = "Hi this is just the test print"
End Sub

Private OtherPrint()
lblTest.text = "Hi this is another print"
End Sub

So as you can see... ASP.NET is VERY different from ASP.

My another question is "Can I still use #include directive in ASP
.NET? I want to break my HTML page into HEADER, SIDE MENU and FOOTER
parts"


No, there is no include.

You'll need to use a templating solution like ASP masterpages.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #3
"=?Utf-8?B?TW9oaXQgR3VwdGE=?=" <Mo********@discussions.microsoft.com>
wrote in news:E2**********************************@microsof t.com:
Why would somebody will then use ASP .NET instead of ASP if ASP style
flow control does not exists. I strictly wanted to have ASP style flow
control. Isn't there any other way?

Your help will be appreciated


You have much to learn...

Because ASP flow control is MESSY. With ASP.NET you can do everything ASP
can and much much more. One thing you have to understand about ASP.NET is
the separation of display and logic. You no longer mix and match logic
(i.e. flow control). In ASP.NET you can replicate flow controls with many
cleaner techniques.

I suggest you check out the .NET tutorials which are available on several
sites like 4guysfromrolla.com.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #4
Thanks Lucas once more.

If this is the case, then as far as I know every object, e.g, <asp:Checkbox
runat=server />, has to have a distinct name in ASP .NET.
I have an array of checkboxes in an asp page, this is how it will be coded
in ASP page

<input type="checkbox" name="checkbox" id="checkboxes" value="0">
<input type="checkbox" name="checkbox" id="checkboxes" value="0">
<input type="checkbox" name="checkbox" id="checkboxes" value="0">

When I retreive the value in ASP, it will be done like

<%
dim checkboxes
For I=0 to Request.Form("checkbox").length
Response.Write Request.Form("checkbox")(I)
Next

%>
How can I achieve the same effect in ASP .NET but as far as names are
concerned it has to be distinct. In my ASPX .NET page can I code like

<asp:checkbox id="checkbox" runat=server value=0 />
<asp:checkbox id="checkbox" runat=server value=0 />
<asp:checkbox id="checkbox" runat=server value=0 />
<asp:checkbox id="checkbox" runat=server value=0 />

I think this will be invalid. I eventually have to code like to give each
checkbox as a distinct name/id which will later be used for reference
purposes in ASPX.vb code

<asp:checkbox id="checkbox1" runat=server value=0 />
<asp:checkbox id="checkbox2" runat=server value=0 />
<asp:checkbox id="checkbox3" runat=server value=0 />
<asp:checkbox id="checkbox4" runat=server value=0 />
My question is how can i achieve the ASP style of scenario in ASP .NET page.

Small piece of code will definitely be helpful.

Thanks
Mohit

"Lucas Tam" wrote:
"=?Utf-8?B?TW9oaXQgR3VwdGE=?=" <Mo********@discussions.microsoft.com>
wrote in news:E2**********************************@microsof t.com:
Why would somebody will then use ASP .NET instead of ASP if ASP style
flow control does not exists. I strictly wanted to have ASP style flow
control. Isn't there any other way?

Your help will be appreciated


You have much to learn...

Because ASP flow control is MESSY. With ASP.NET you can do everything ASP
can and much much more. One thing you have to understand about ASP.NET is
the separation of display and logic. You no longer mix and match logic
(i.e. flow control). In ASP.NET you can replicate flow controls with many
cleaner techniques.

I suggest you check out the .NET tutorials which are available on several
sites like 4guysfromrolla.com.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #5
Lucas Tam wrote:
"=?Utf-8?B?TW9oaXQgR3VwdGE=?=" <Mo********@discussions.microsoft.com>
wrote in news:82**********************************@microsof t.com:
My another question is "Can I still use #include directive in ASP
.NET? I want to break my HTML page into HEADER, SIDE MENU and FOOTER
parts"


No, there is no include.

You'll need to use a templating solution like ASP masterpages.


Or use Web User Controls for header, side menu, footer etc.

Hans Kesting
Nov 18 '05 #6
I'll recommand you use asp:CheckBoxList instead.
You can check the control's status by checkboxlist1.Items[i].Selected =
true/false.

"Mohit Gupta" <Mo********@discussions.microsoft.com> ¦b¶l¥ó
news:03**********************************@microsof t.com ¤¤¼¶¼g...
Thanks Lucas once more.

If this is the case, then as far as I know every object, e.g, <asp:Checkbox runat=server />, has to have a distinct name in ASP .NET.
I have an array of checkboxes in an asp page, this is how it will be coded in ASP page

<input type="checkbox" name="checkbox" id="checkboxes" value="0">
<input type="checkbox" name="checkbox" id="checkboxes" value="0">
<input type="checkbox" name="checkbox" id="checkboxes" value="0">

When I retreive the value in ASP, it will be done like

<%
dim checkboxes
For I=0 to Request.Form("checkbox").length
Response.Write Request.Form("checkbox")(I)
Next

%>
How can I achieve the same effect in ASP .NET but as far as names are
concerned it has to be distinct. In my ASPX .NET page can I code like

<asp:checkbox id="checkbox" runat=server value=0 />
<asp:checkbox id="checkbox" runat=server value=0 />
<asp:checkbox id="checkbox" runat=server value=0 />
<asp:checkbox id="checkbox" runat=server value=0 />

I think this will be invalid. I eventually have to code like to give each
checkbox as a distinct name/id which will later be used for reference
purposes in ASPX.vb code

<asp:checkbox id="checkbox1" runat=server value=0 />
<asp:checkbox id="checkbox2" runat=server value=0 />
<asp:checkbox id="checkbox3" runat=server value=0 />
<asp:checkbox id="checkbox4" runat=server value=0 />
My question is how can i achieve the ASP style of scenario in ASP .NET page.
Small piece of code will definitely be helpful.

Thanks
Mohit

"Lucas Tam" wrote:
"=?Utf-8?B?TW9oaXQgR3VwdGE=?=" <Mo********@discussions.microsoft.com>
wrote in news:E2**********************************@microsof t.com:
Why would somebody will then use ASP .NET instead of ASP if ASP style
flow control does not exists. I strictly wanted to have ASP style flow
control. Isn't there any other way?

Your help will be appreciated


You have much to learn...

Because ASP flow control is MESSY. With ASP.NET you can do everything ASP can and much much more. One thing you have to understand about ASP.NET is the separation of display and logic. You no longer mix and match logic
(i.e. flow control). In ASP.NET you can replicate flow controls with many cleaner techniques.

I suggest you check out the .NET tutorials which are available on several sites like 4guysfromrolla.com.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #7
I don't why I find Web user Control so difficult.

I think I have to work bit hard to under stand ASP .NET concept.

Hmmm!!! Giving bit of thought, web development with ASP .NET, according to
me, will take the longest time as compared to ASP.

Same is the case with ASP and PHP/PERL

I have recently been invovled with ASP and PHP web development, but some how
ASP .NET work flow is very very different and difficult as well.

"Hans Kesting" wrote:
Lucas Tam wrote:
"=?Utf-8?B?TW9oaXQgR3VwdGE=?=" <Mo********@discussions.microsoft.com>
wrote in news:82**********************************@microsof t.com:
My another question is "Can I still use #include directive in ASP
.NET? I want to break my HTML page into HEADER, SIDE MENU and FOOTER
parts"


No, there is no include.

You'll need to use a templating solution like ASP masterpages.


Or use Web User Controls for header, side menu, footer etc.

Hans Kesting

Nov 18 '05 #8
Mohit Gupta wrote:
I don't why I find Web user Control so difficult.

I think I have to work bit hard to under stand ASP .NET concept.

Hmmm!!! Giving bit of thought, web development with ASP .NET,
according to me, will take the longest time as compared to ASP.

Same is the case with ASP and PHP/PERL

I have recently been invovled with ASP and PHP web development, but
some how ASP .NET work flow is very very different and difficult as
well.


ASP (old-style) and PHP both mix text for output (usually HTML) and code.
When executing the code you build some text file that happens to be in HTML format.

With ASP.Net you build an object tree that eventually renders as HTML.

It's quite a step, but it's worth it (I think).

Hans Kesting
Nov 18 '05 #9


"Lucas Tam" wrote:

Yes, initial development will take longer with ASP, however, maintenance
and scalibility is greater with ASP.NET.
Yeah!!! I strongly agree with you. It is all about experience. For a newbie
like me in ASP .NET, and an expert in PHP or ASP, initially it is very hard
to grasp the idea of ASP .NET because in PHP or ASP we can merge ASP code
with HTML code.

One good thing that I liked about ASP .NET is object oriented concept.
However, if you are aware of PHP 5, it has also introduced OO concept and to
me, I think, web development will be atleast 10 times faster in PHP than
either ASP or ASP .NET. I am not contradicting or criticising anybody. It is
just a matter of experience and learning.

Moving to any new technology is always painful in the begining but when one
start getting hold of subtleties of that, things become very interesting.

I think in terms of POSTBACK operations, ASP .NET is really ahead. Atleast
it saves some time of mine to refill the values programmatically in PHP or
ASP. Alteast microsoft this time has done good job (I think) to relieve some
pressure from programmers.

There are lot of things to learn in ASP .NET then in any other technology.

It's much easier to fix ASP.NET code than it is to fix ASP code.

I am really not sure about it. However, I know one thing is that it is much
difficult to learn ASP .NET. Mainly because of single form. Normally in an
HTML page, we can have multiple forms where element values can be exchanged
between different forms. But in ASP .NET there is only 1 form concept and I
am still very confused that how to use multiple form concept.

Secondly, the concept of RegisterScriptBlock ( I think) for inserting
javascript. I am still not sure why to use it.

Consider an example below

<asp:Button runat=server id=Button1 onClick="testClick()" />

<SCRIPT LANGUAGE="javascript">
function testClick() {
:
}
</SCRIPT>

When I put above code in aspx page, server reports me an error about
"testClick()" method don't found or something like that.

But when in my .aspx.vb file, I put this statement

Me.Button1.RegisterScriptBlock(.....,"testClick()" ), everything works fine.

So I think there are still lot of things to work on for me and I don't know
how long it will take to fully understand the concept.

ASP.NET is a totally different beast. There's no other web development
language quite like it. It'll take a while for you to get your head around
all the subtleties, but once you do, I'm sure you won't regret learning
ASP.NET.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #10

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

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.