Just starting to learn asp.net but i dont understand
what postback is for. I have never in asp.old, php or perl
etc. sent the user back to the same page when a submit button
is clicked. Does asp.net insist on this in order to do
automatic validation of inputfields, or is there some other
explaination?? End result is that I always have to do
Response.Redirect() after a submit, which seems clumsy. I am
doing something wrong??Generaly postback is the process of sending form back to the server, but
actually postback is also the client-side script function which initialize
sending web form to the web server. This function is embedded to the
rendered HTML by ASP.NET Framework.
ASP.NET framework allows developer to determ is the page requested for first
time or this form processing is the result of postback
"me" <wtumaxi@.forum.dk> wrote in message
news:6fd6d897.0402160452.727f92f@.posting.google.co m...
> Just starting to learn asp.net but i dont understand
> what postback is for. I have never in asp.old, php or perl
> etc. sent the user back to the same page when a submit button
> is clicked. Does asp.net insist on this in order to do
> automatic validation of inputfields, or is there some other
> explaination?? End result is that I always have to do
> Response.Redirect() after a submit, which seems clumsy. I am
> doing something wrong??
My own opinion, but I think it helps keep code more object-oriented to have
a submit button postback to the same page. That way, you don't have two
separate pages that handle the processing associated with a given form.
For example, a login page:
Old way is to have the username & password textboxes on one page, then the
submit button sends to an authorize page that checks to see if it is legal
username/password and does whatever else. In asp.net, all of that is
handled in a single class / web page. It helps with validation, and from a
developer's point of view, it keeps everything associated with login
isolated to the one class/page. And then, you are correct, you would use a
Response.Redirect() to send the user to either an "Access Denied" page or on
to the rest of the site as an authenticated user. That's just one example.
If you change the name of textboxes, or add other fields & controls, you
(generally) only have to worry about changes within the same class - other
web pages won't be affected.
--
Mike Mayer, C# MVP
mike@.mag37.com
http://www.mag37.com/csharp/
"me" <wtumaxi@.forum.dk> wrote in message
news:6fd6d897.0402160452.727f92f@.posting.google.co m...
> Just starting to learn asp.net but i dont understand
> what postback is for. I have never in asp.old, php or perl
> etc. sent the user back to the same page when a submit button
> is clicked. Does asp.net insist on this in order to do
> automatic validation of inputfields, or is there some other
> explaination?? End result is that I always have to do
> Response.Redirect() after a submit, which seems clumsy. I am
> doing something wrong??
Showing posts with label php. Show all posts
Showing posts with label php. Show all posts
Saturday, March 24, 2012
Thursday, March 22, 2012
Newbish questions but need advice
Ok , Im trying to convert a page I made in PHP to ASP and it sounded a lot easier than it is. So I have a couple questions.
First question
The page I created requires a lot of functions. Is there anyway I canhave an include file at the top of the page or do I have to have allthe functions listed out at the top?
Second question
How do I maintain the same look across all page? In PHP i could simplyhave each link change the page state and certain things would loadbased on the page state. I figured a way to get around this would be tohave like the standard look as an include file at the top of each pagebut I havnt figured out how to do this yet.
Any help is greatly appreciated.
First question
The page I created requires a lot of functions. Is there anyway I canhave an include file at the top of the page or do I have to have allthe functions listed out at the top?
Second question
How do I maintain the same look across all page? In PHP i could simplyhave each link change the page state and certain things would loadbased on the page state. I figured a way to get around this would be tohave like the standard look as an include file at the top of each pagebut I havnt figured out how to do this yet.
Any help is greatly appreciated.
1. Check out this tutorial on Function Libraries:
http://aspnet101.com/aspnet101/tutorials.aspx?id=43
However, if the functions/subs are written in concordance with ASP.Net practices, you can also use includes, just as you can with Classic ASP and PHP
2. Stylesheets work with ASP.Net, just like they work with any HTML page. - - if this isn't what you're talking about, please expand on your question so we can get a better idea of exactly what you're trying to accomplish.
Friday, March 16, 2012
newsbie if-then-else question
Hello,
I just made to move to ASP. I have been developing in PHP the past two
years. I must say that I'm a little disappointed in the quality of the
beginners tutorials. They don't go further then teaching
<% Response.Write("Hello World") %
I also lack an official website with all ASP commands explained, like
you have php.net for PHP.
Anyway, here I go, this piece of code contains a bug:
If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
Then (
left = "column_left_nl.html"
top = "top_nl.html"
)
Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
lang2 = "fr") Then (
left = "column_left_fr.html"
top = "top_fr.html"
)
Else if (lang2 = "ENG" OR lang2 = "eng") Then (
left = "column_left_eng.html"
top = "top_eng.html"
)
End If
There is no tutorial that explains me whether to use brackets or not
and which kind of brackets I should use. So, do I need all these
brackets?
And why is:
lang = "DUT"
a declaration, and a couple lines further a comparison?
I'm really confused, please help me out.
Greetz,
BartonYou might be happier... much happier, with C#. It's a much more
specific/hard-lined language where there aren't as many assumptions, like in
VB. With ASP.NET, you can write your app in any CLR-compliant language
(VB.NET, C#, J#,managed C++?).. here's that code in C#:
if (lang2 == "DUT" || lang2 == "dut" || lang2 == "NL" || lang2 == "nl")
{
left = "column_left_nl.html";
top = "top_nl.html";
}
elseif (lang2 == "FRE" || lang2 == "fre" || lang2 == "FR" || lang2 == "fr")
{
left = "column_left_fr.html";
top = "top_fr.html";
}
elseif (lang2 == "ENG"
|| lang2 == "eng")
{
left = "column_left_eng.html";
top = "top_eng.html";
}
There are no assumptions. = is for assignment, == is for comparison..
semi-colons terminate a line, etc, etc...
"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> Hello,
> I just made to move to ASP. I have been developing in PHP the past two
> years. I must say that I'm a little disappointed in the quality of the
> beginners tutorials. They don't go further then teaching
> <% Response.Write("Hello World") %>
> I also lack an official website with all ASP commands explained, like
> you have php.net for PHP.
> Anyway, here I go, this piece of code contains a bug:
> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> Then (
> left = "column_left_nl.html"
> top = "top_nl.html"
> )
> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> lang2 = "fr") Then (
> left = "column_left_fr.html"
> top = "top_fr.html"
> )
> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> left = "column_left_eng.html"
> top = "top_eng.html"
> )
> End If
> There is no tutorial that explains me whether to use brackets or not
> and which kind of brackets I should use. So, do I need all these
> brackets?
> And why is:
> lang = "DUT"
> a declaration, and a couple lines further a comparison?
> I'm really confused, please help me out.
> Greetz,
> Barton
Go to http://codemaster.digitalrice.com and check the ASP section for
beginners tutorial
"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> Hello,
> I just made to move to ASP. I have been developing in PHP the past two
> years. I must say that I'm a little disappointed in the quality of the
> beginners tutorials. They don't go further then teaching
> <% Response.Write("Hello World") %>
> I also lack an official website with all ASP commands explained, like
> you have php.net for PHP.
> Anyway, here I go, this piece of code contains a bug:
> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> Then (
> left = "column_left_nl.html"
> top = "top_nl.html"
> )
> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> lang2 = "fr") Then (
> left = "column_left_fr.html"
> top = "top_fr.html"
> )
> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> left = "column_left_eng.html"
> top = "top_eng.html"
> )
> End If
> There is no tutorial that explains me whether to use brackets or not
> and which kind of brackets I should use. So, do I need all these
> brackets?
> And why is:
> lang = "DUT"
> a declaration, and a couple lines further a comparison?
> I'm really confused, please help me out.
> Greetz,
> Barton
I use them to be more clear
"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> Hello,
> I just made to move to ASP. I have been developing in PHP the past two
> years. I must say that I'm a little disappointed in the quality of the
> beginners tutorials. They don't go further then teaching
> <% Response.Write("Hello World") %>
> I also lack an official website with all ASP commands explained, like
> you have php.net for PHP.
> Anyway, here I go, this piece of code contains a bug:
> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> Then (
> left = "column_left_nl.html"
> top = "top_nl.html"
> )
> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> lang2 = "fr") Then (
> left = "column_left_fr.html"
> top = "top_fr.html"
> )
> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> left = "column_left_eng.html"
> top = "top_eng.html"
> )
> End If
> There is no tutorial that explains me whether to use brackets or not
> and which kind of brackets I should use. So, do I need all these
> brackets?
> And why is:
> lang = "DUT"
> a declaration, and a couple lines further a comparison?
> I'm really confused, please help me out.
> Greetz,
> Barton
I'm not impressed with the Tutorials. They are too basic! And they
don't tell anything about the brackets, about ISSET commands etc.
Greetz,
Barton
On Tue, 26 Aug 2003 02:28:50 +0600, "Arsalan"
<arsalan_aslam@.hotmail.com> wrote:
>Go to http://codemaster.digitalrice.com and check the ASP section for
>beginners tutorial
>"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
>news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
>> Hello,
>>
>> I just made to move to ASP. I have been developing in PHP the past two
>> years. I must say that I'm a little disappointed in the quality of the
>> beginners tutorials. They don't go further then teaching
>>
>> <% Response.Write("Hello World") %>
>>
>> I also lack an official website with all ASP commands explained, like
>> you have php.net for PHP.
>>
>> Anyway, here I go, this piece of code contains a bug:
>>
>> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
>> Then (
>> left = "column_left_nl.html"
>> top = "top_nl.html"
>> )
>> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
>> lang2 = "fr") Then (
>> left = "column_left_fr.html"
>> top = "top_fr.html"
>> )
>> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
>> left = "column_left_eng.html"
>> top = "top_eng.html"
>> )
>> End If
>>
>> There is no tutorial that explains me whether to use brackets or not
>> and which kind of brackets I should use. So, do I need all these
>> brackets?
>>
>> And why is:
>>
>> lang = "DUT"
>>
>> a declaration, and a couple lines further a comparison?
>> I'm really confused, please help me out.
>>
>> Greetz,
>>
>> Barton
Well, this sounds much more familiar to me!
I'm used to "=" and "==" and also the ";" for ending lines.
But does this C# run at every normal ISS server?
Greetz,
Barton
On Mon, 25 Aug 2003 20:13:39 GMT, "Frank Drebin"
<noemail@.imsickofspam.com> wrote:
>You might be happier... much happier, with C#. It's a much more
>specific/hard-lined language where there aren't as many assumptions, like in
>VB. With ASP.NET, you can write your app in any CLR-compliant language
>(VB.NET, C#, J#,managed C++?).. here's that code in C#:
>if (lang2 == "DUT" || lang2 == "dut" || lang2 == "NL" || lang2 == "nl")
>{
> left = "column_left_nl.html";
> top = "top_nl.html";
>}
>elseif (lang2 == "FRE" || lang2 == "fre" || lang2 == "FR" || lang2 == "fr")
>{
> left = "column_left_fr.html";
> top = "top_fr.html";
>}
>elseif (lang2 == "ENG"
> || lang2 == "eng")
>{
> left = "column_left_eng.html";
> top = "top_eng.html";
>}
>There are no assumptions. = is for assignment, == is for comparison..
>semi-colons terminate a line, etc, etc...
>
>"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
>news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
>> Hello,
>>
>> I just made to move to ASP. I have been developing in PHP the past two
>> years. I must say that I'm a little disappointed in the quality of the
>> beginners tutorials. They don't go further then teaching
>>
>> <% Response.Write("Hello World") %>
>>
>> I also lack an official website with all ASP commands explained, like
>> you have php.net for PHP.
>>
>> Anyway, here I go, this piece of code contains a bug:
>>
>> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
>> Then (
>> left = "column_left_nl.html"
>> top = "top_nl.html"
>> )
>> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
>> lang2 = "fr") Then (
>> left = "column_left_fr.html"
>> top = "top_fr.html"
>> )
>> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
>> left = "column_left_eng.html"
>> top = "top_eng.html"
>> )
>> End If
>>
>> There is no tutorial that explains me whether to use brackets or not
>> and which kind of brackets I should use. So, do I need all these
>> brackets?
>>
>> And why is:
>>
>> lang = "DUT"
>>
>> a declaration, and a couple lines further a comparison?
>> I'm really confused, please help me out.
>>
>> Greetz,
>>
>> Barton
I would write the code as such
If lang2.ToUpper = "DUT" OR lang2.ToUpper = "NL" Then
left = "column_left_nl.html"
top = "top_nl.html"
ElseIf lang2.ToUpper = "FRE" OR lang2.ToUpper = "FR" Then
left = "column_left_fr.html"
top = "top_fr.html"
ElseIf lang2.ToUpper = "ENG" Then
left = "column_left_eng.html"
top = "top_eng.html"
End If
This is very readable to me, but then I learned .NET using VB not C#
Severin
"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> Hello,
> I just made to move to ASP. I have been developing in PHP the past two
> years. I must say that I'm a little disappointed in the quality of the
> beginners tutorials. They don't go further then teaching
> <% Response.Write("Hello World") %>
> I also lack an official website with all ASP commands explained, like
> you have php.net for PHP.
> Anyway, here I go, this piece of code contains a bug:
> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> Then (
> left = "column_left_nl.html"
> top = "top_nl.html"
> )
> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> lang2 = "fr") Then (
> left = "column_left_fr.html"
> top = "top_fr.html"
> )
> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> left = "column_left_eng.html"
> top = "top_eng.html"
> )
> End If
> There is no tutorial that explains me whether to use brackets or not
> and which kind of brackets I should use. So, do I need all these
> brackets?
> And why is:
> lang = "DUT"
> a declaration, and a couple lines further a comparison?
> I'm really confused, please help me out.
> Greetz,
> Barton
I get the error: Object required: 'DUT'
Seems I first need to make an object of DUT?
How do I do this?
Greetz,
Barton
On Mon, 25 Aug 2003 16:48:28 -0500, "Severin" <sev@.sevsamp.com> wrote:
>I would write the code as such
>If lang2.ToUpper = "DUT" OR lang2.ToUpper = "NL" Then
> left = "column_left_nl.html"
> top = "top_nl.html"
>ElseIf lang2.ToUpper = "FRE" OR lang2.ToUpper = "FR" Then
> left = "column_left_fr.html"
> top = "top_fr.html"
>ElseIf lang2.ToUpper = "ENG" Then
> left = "column_left_eng.html"
> top = "top_eng.html"
>End If
>
>This is very readable to me, but then I learned .NET using VB not C#
>Severin
>
>
>
>"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
>news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
>> Hello,
>>
>> I just made to move to ASP. I have been developing in PHP the past two
>> years. I must say that I'm a little disappointed in the quality of the
>> beginners tutorials. They don't go further then teaching
>>
>> <% Response.Write("Hello World") %>
>>
>> I also lack an official website with all ASP commands explained, like
>> you have php.net for PHP.
>>
>> Anyway, here I go, this piece of code contains a bug:
>>
>> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
>> Then (
>> left = "column_left_nl.html"
>> top = "top_nl.html"
>> )
>> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
>> lang2 = "fr") Then (
>> left = "column_left_fr.html"
>> top = "top_fr.html"
>> )
>> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
>> left = "column_left_eng.html"
>> top = "top_eng.html"
>> )
>> End If
>>
>> There is no tutorial that explains me whether to use brackets or not
>> and which kind of brackets I should use. So, do I need all these
>> brackets?
>>
>> And why is:
>>
>> lang = "DUT"
>>
>> a declaration, and a couple lines further a comparison?
>> I'm really confused, please help me out.
>>
>> Greetz,
>>
>> Barton
Severin,
A Select Case statement might be more readable.
Select Case lang2.ToUpper
Case "DUT", "NL"
left = "column_left_nl.html"
top = "top_nl.html"
Case "FRE", "FR"
left = "column_left_fr.html"
top = "top_fr.html"
Case "ENG"
left = "column_left_eng.html"
top = "top_eng.html"
End Select
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Severin" <sev@.sevsamp.com> wrote in message
news:bie016$8h@.library2.airnews.net...
> I would write the code as such
> If lang2.ToUpper = "DUT" OR lang2.ToUpper = "NL" Then
> left = "column_left_nl.html"
> top = "top_nl.html"
> ElseIf lang2.ToUpper = "FRE" OR lang2.ToUpper = "FR" Then
> left = "column_left_fr.html"
> top = "top_fr.html"
> ElseIf lang2.ToUpper = "ENG" Then
> left = "column_left_eng.html"
> top = "top_eng.html"
> End If
>
> This is very readable to me, but then I learned .NET using VB not C#
> Severin
>
>
>
> "Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
> news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> > Hello,
> > I just made to move to ASP. I have been developing in PHP the past two
> > years. I must say that I'm a little disappointed in the quality of the
> > beginners tutorials. They don't go further then teaching
> > <% Response.Write("Hello World") %>
> > I also lack an official website with all ASP commands explained, like
> > you have php.net for PHP.
> > Anyway, here I go, this piece of code contains a bug:
> > If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> > Then (
> > left = "column_left_nl.html"
> > top = "top_nl.html"
> > )
> > Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> > lang2 = "fr") Then (
> > left = "column_left_fr.html"
> > top = "top_fr.html"
> > )
> > Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> > left = "column_left_eng.html"
> > top = "top_eng.html"
> > )
> > End If
> > There is no tutorial that explains me whether to use brackets or not
> > and which kind of brackets I should use. So, do I need all these
> > brackets?
> > And why is:
> > lang = "DUT"
> > a declaration, and a couple lines further a comparison?
> > I'm really confused, please help me out.
> > Greetz,
> > Barton
Severin,
A Select Case statement might be more readable.
Select Case lang2.ToUpper
Case "DUT", "NL"
left = "column_left_nl.html"
top = "top_nl.html"
Case "FRE", "FR"
left = "column_left_fr.html"
top = "top_fr.html"
Case "ENG"
left = "column_left_eng.html"
top = "top_eng.html"
End Select
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Severin" <sev@.sevsamp.com> wrote in message
news:bie016$8h@.library2.airnews.net...
> I would write the code as such
> If lang2.ToUpper = "DUT" OR lang2.ToUpper = "NL" Then
> left = "column_left_nl.html"
> top = "top_nl.html"
> ElseIf lang2.ToUpper = "FRE" OR lang2.ToUpper = "FR" Then
> left = "column_left_fr.html"
> top = "top_fr.html"
> ElseIf lang2.ToUpper = "ENG" Then
> left = "column_left_eng.html"
> top = "top_eng.html"
> End If
>
> This is very readable to me, but then I learned .NET using VB not C#
> Severin
>
>
>
> "Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
> news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> > Hello,
> > I just made to move to ASP. I have been developing in PHP the past two
> > years. I must say that I'm a little disappointed in the quality of the
> > beginners tutorials. They don't go further then teaching
> > <% Response.Write("Hello World") %>
> > I also lack an official website with all ASP commands explained, like
> > you have php.net for PHP.
> > Anyway, here I go, this piece of code contains a bug:
> > If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> > Then (
> > left = "column_left_nl.html"
> > top = "top_nl.html"
> > )
> > Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> > lang2 = "fr") Then (
> > left = "column_left_fr.html"
> > top = "top_fr.html"
> > )
> > Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> > left = "column_left_eng.html"
> > top = "top_eng.html"
> > )
> > End If
> > There is no tutorial that explains me whether to use brackets or not
> > and which kind of brackets I should use. So, do I need all these
> > brackets?
> > And why is:
> > lang = "DUT"
> > a declaration, and a couple lines further a comparison?
> > I'm really confused, please help me out.
> > Greetz,
> > Barton
I just made to move to ASP. I have been developing in PHP the past two
years. I must say that I'm a little disappointed in the quality of the
beginners tutorials. They don't go further then teaching
<% Response.Write("Hello World") %
I also lack an official website with all ASP commands explained, like
you have php.net for PHP.
Anyway, here I go, this piece of code contains a bug:
If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
Then (
left = "column_left_nl.html"
top = "top_nl.html"
)
Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
lang2 = "fr") Then (
left = "column_left_fr.html"
top = "top_fr.html"
)
Else if (lang2 = "ENG" OR lang2 = "eng") Then (
left = "column_left_eng.html"
top = "top_eng.html"
)
End If
There is no tutorial that explains me whether to use brackets or not
and which kind of brackets I should use. So, do I need all these
brackets?
And why is:
lang = "DUT"
a declaration, and a couple lines further a comparison?
I'm really confused, please help me out.
Greetz,
BartonYou might be happier... much happier, with C#. It's a much more
specific/hard-lined language where there aren't as many assumptions, like in
VB. With ASP.NET, you can write your app in any CLR-compliant language
(VB.NET, C#, J#,managed C++?).. here's that code in C#:
if (lang2 == "DUT" || lang2 == "dut" || lang2 == "NL" || lang2 == "nl")
{
left = "column_left_nl.html";
top = "top_nl.html";
}
elseif (lang2 == "FRE" || lang2 == "fre" || lang2 == "FR" || lang2 == "fr")
{
left = "column_left_fr.html";
top = "top_fr.html";
}
elseif (lang2 == "ENG"
|| lang2 == "eng")
{
left = "column_left_eng.html";
top = "top_eng.html";
}
There are no assumptions. = is for assignment, == is for comparison..
semi-colons terminate a line, etc, etc...
"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> Hello,
> I just made to move to ASP. I have been developing in PHP the past two
> years. I must say that I'm a little disappointed in the quality of the
> beginners tutorials. They don't go further then teaching
> <% Response.Write("Hello World") %>
> I also lack an official website with all ASP commands explained, like
> you have php.net for PHP.
> Anyway, here I go, this piece of code contains a bug:
> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> Then (
> left = "column_left_nl.html"
> top = "top_nl.html"
> )
> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> lang2 = "fr") Then (
> left = "column_left_fr.html"
> top = "top_fr.html"
> )
> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> left = "column_left_eng.html"
> top = "top_eng.html"
> )
> End If
> There is no tutorial that explains me whether to use brackets or not
> and which kind of brackets I should use. So, do I need all these
> brackets?
> And why is:
> lang = "DUT"
> a declaration, and a couple lines further a comparison?
> I'm really confused, please help me out.
> Greetz,
> Barton
Go to http://codemaster.digitalrice.com and check the ASP section for
beginners tutorial
"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> Hello,
> I just made to move to ASP. I have been developing in PHP the past two
> years. I must say that I'm a little disappointed in the quality of the
> beginners tutorials. They don't go further then teaching
> <% Response.Write("Hello World") %>
> I also lack an official website with all ASP commands explained, like
> you have php.net for PHP.
> Anyway, here I go, this piece of code contains a bug:
> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> Then (
> left = "column_left_nl.html"
> top = "top_nl.html"
> )
> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> lang2 = "fr") Then (
> left = "column_left_fr.html"
> top = "top_fr.html"
> )
> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> left = "column_left_eng.html"
> top = "top_eng.html"
> )
> End If
> There is no tutorial that explains me whether to use brackets or not
> and which kind of brackets I should use. So, do I need all these
> brackets?
> And why is:
> lang = "DUT"
> a declaration, and a couple lines further a comparison?
> I'm really confused, please help me out.
> Greetz,
> Barton
I use them to be more clear
"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> Hello,
> I just made to move to ASP. I have been developing in PHP the past two
> years. I must say that I'm a little disappointed in the quality of the
> beginners tutorials. They don't go further then teaching
> <% Response.Write("Hello World") %>
> I also lack an official website with all ASP commands explained, like
> you have php.net for PHP.
> Anyway, here I go, this piece of code contains a bug:
> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> Then (
> left = "column_left_nl.html"
> top = "top_nl.html"
> )
> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> lang2 = "fr") Then (
> left = "column_left_fr.html"
> top = "top_fr.html"
> )
> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> left = "column_left_eng.html"
> top = "top_eng.html"
> )
> End If
> There is no tutorial that explains me whether to use brackets or not
> and which kind of brackets I should use. So, do I need all these
> brackets?
> And why is:
> lang = "DUT"
> a declaration, and a couple lines further a comparison?
> I'm really confused, please help me out.
> Greetz,
> Barton
I'm not impressed with the Tutorials. They are too basic! And they
don't tell anything about the brackets, about ISSET commands etc.
Greetz,
Barton
On Tue, 26 Aug 2003 02:28:50 +0600, "Arsalan"
<arsalan_aslam@.hotmail.com> wrote:
>Go to http://codemaster.digitalrice.com and check the ASP section for
>beginners tutorial
>"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
>news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
>> Hello,
>>
>> I just made to move to ASP. I have been developing in PHP the past two
>> years. I must say that I'm a little disappointed in the quality of the
>> beginners tutorials. They don't go further then teaching
>>
>> <% Response.Write("Hello World") %>
>>
>> I also lack an official website with all ASP commands explained, like
>> you have php.net for PHP.
>>
>> Anyway, here I go, this piece of code contains a bug:
>>
>> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
>> Then (
>> left = "column_left_nl.html"
>> top = "top_nl.html"
>> )
>> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
>> lang2 = "fr") Then (
>> left = "column_left_fr.html"
>> top = "top_fr.html"
>> )
>> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
>> left = "column_left_eng.html"
>> top = "top_eng.html"
>> )
>> End If
>>
>> There is no tutorial that explains me whether to use brackets or not
>> and which kind of brackets I should use. So, do I need all these
>> brackets?
>>
>> And why is:
>>
>> lang = "DUT"
>>
>> a declaration, and a couple lines further a comparison?
>> I'm really confused, please help me out.
>>
>> Greetz,
>>
>> Barton
Well, this sounds much more familiar to me!
I'm used to "=" and "==" and also the ";" for ending lines.
But does this C# run at every normal ISS server?
Greetz,
Barton
On Mon, 25 Aug 2003 20:13:39 GMT, "Frank Drebin"
<noemail@.imsickofspam.com> wrote:
>You might be happier... much happier, with C#. It's a much more
>specific/hard-lined language where there aren't as many assumptions, like in
>VB. With ASP.NET, you can write your app in any CLR-compliant language
>(VB.NET, C#, J#,managed C++?).. here's that code in C#:
>if (lang2 == "DUT" || lang2 == "dut" || lang2 == "NL" || lang2 == "nl")
>{
> left = "column_left_nl.html";
> top = "top_nl.html";
>}
>elseif (lang2 == "FRE" || lang2 == "fre" || lang2 == "FR" || lang2 == "fr")
>{
> left = "column_left_fr.html";
> top = "top_fr.html";
>}
>elseif (lang2 == "ENG"
> || lang2 == "eng")
>{
> left = "column_left_eng.html";
> top = "top_eng.html";
>}
>There are no assumptions. = is for assignment, == is for comparison..
>semi-colons terminate a line, etc, etc...
>
>"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
>news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
>> Hello,
>>
>> I just made to move to ASP. I have been developing in PHP the past two
>> years. I must say that I'm a little disappointed in the quality of the
>> beginners tutorials. They don't go further then teaching
>>
>> <% Response.Write("Hello World") %>
>>
>> I also lack an official website with all ASP commands explained, like
>> you have php.net for PHP.
>>
>> Anyway, here I go, this piece of code contains a bug:
>>
>> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
>> Then (
>> left = "column_left_nl.html"
>> top = "top_nl.html"
>> )
>> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
>> lang2 = "fr") Then (
>> left = "column_left_fr.html"
>> top = "top_fr.html"
>> )
>> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
>> left = "column_left_eng.html"
>> top = "top_eng.html"
>> )
>> End If
>>
>> There is no tutorial that explains me whether to use brackets or not
>> and which kind of brackets I should use. So, do I need all these
>> brackets?
>>
>> And why is:
>>
>> lang = "DUT"
>>
>> a declaration, and a couple lines further a comparison?
>> I'm really confused, please help me out.
>>
>> Greetz,
>>
>> Barton
I would write the code as such
If lang2.ToUpper = "DUT" OR lang2.ToUpper = "NL" Then
left = "column_left_nl.html"
top = "top_nl.html"
ElseIf lang2.ToUpper = "FRE" OR lang2.ToUpper = "FR" Then
left = "column_left_fr.html"
top = "top_fr.html"
ElseIf lang2.ToUpper = "ENG" Then
left = "column_left_eng.html"
top = "top_eng.html"
End If
This is very readable to me, but then I learned .NET using VB not C#
Severin
"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> Hello,
> I just made to move to ASP. I have been developing in PHP the past two
> years. I must say that I'm a little disappointed in the quality of the
> beginners tutorials. They don't go further then teaching
> <% Response.Write("Hello World") %>
> I also lack an official website with all ASP commands explained, like
> you have php.net for PHP.
> Anyway, here I go, this piece of code contains a bug:
> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> Then (
> left = "column_left_nl.html"
> top = "top_nl.html"
> )
> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> lang2 = "fr") Then (
> left = "column_left_fr.html"
> top = "top_fr.html"
> )
> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> left = "column_left_eng.html"
> top = "top_eng.html"
> )
> End If
> There is no tutorial that explains me whether to use brackets or not
> and which kind of brackets I should use. So, do I need all these
> brackets?
> And why is:
> lang = "DUT"
> a declaration, and a couple lines further a comparison?
> I'm really confused, please help me out.
> Greetz,
> Barton
I get the error: Object required: 'DUT'
Seems I first need to make an object of DUT?
How do I do this?
Greetz,
Barton
On Mon, 25 Aug 2003 16:48:28 -0500, "Severin" <sev@.sevsamp.com> wrote:
>I would write the code as such
>If lang2.ToUpper = "DUT" OR lang2.ToUpper = "NL" Then
> left = "column_left_nl.html"
> top = "top_nl.html"
>ElseIf lang2.ToUpper = "FRE" OR lang2.ToUpper = "FR" Then
> left = "column_left_fr.html"
> top = "top_fr.html"
>ElseIf lang2.ToUpper = "ENG" Then
> left = "column_left_eng.html"
> top = "top_eng.html"
>End If
>
>This is very readable to me, but then I learned .NET using VB not C#
>Severin
>
>
>
>"Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
>news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
>> Hello,
>>
>> I just made to move to ASP. I have been developing in PHP the past two
>> years. I must say that I'm a little disappointed in the quality of the
>> beginners tutorials. They don't go further then teaching
>>
>> <% Response.Write("Hello World") %>
>>
>> I also lack an official website with all ASP commands explained, like
>> you have php.net for PHP.
>>
>> Anyway, here I go, this piece of code contains a bug:
>>
>> If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
>> Then (
>> left = "column_left_nl.html"
>> top = "top_nl.html"
>> )
>> Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
>> lang2 = "fr") Then (
>> left = "column_left_fr.html"
>> top = "top_fr.html"
>> )
>> Else if (lang2 = "ENG" OR lang2 = "eng") Then (
>> left = "column_left_eng.html"
>> top = "top_eng.html"
>> )
>> End If
>>
>> There is no tutorial that explains me whether to use brackets or not
>> and which kind of brackets I should use. So, do I need all these
>> brackets?
>>
>> And why is:
>>
>> lang = "DUT"
>>
>> a declaration, and a couple lines further a comparison?
>> I'm really confused, please help me out.
>>
>> Greetz,
>>
>> Barton
Severin,
A Select Case statement might be more readable.
Select Case lang2.ToUpper
Case "DUT", "NL"
left = "column_left_nl.html"
top = "top_nl.html"
Case "FRE", "FR"
left = "column_left_fr.html"
top = "top_fr.html"
Case "ENG"
left = "column_left_eng.html"
top = "top_eng.html"
End Select
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Severin" <sev@.sevsamp.com> wrote in message
news:bie016$8h@.library2.airnews.net...
> I would write the code as such
> If lang2.ToUpper = "DUT" OR lang2.ToUpper = "NL" Then
> left = "column_left_nl.html"
> top = "top_nl.html"
> ElseIf lang2.ToUpper = "FRE" OR lang2.ToUpper = "FR" Then
> left = "column_left_fr.html"
> top = "top_fr.html"
> ElseIf lang2.ToUpper = "ENG" Then
> left = "column_left_eng.html"
> top = "top_eng.html"
> End If
>
> This is very readable to me, but then I learned .NET using VB not C#
> Severin
>
>
>
> "Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
> news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> > Hello,
> > I just made to move to ASP. I have been developing in PHP the past two
> > years. I must say that I'm a little disappointed in the quality of the
> > beginners tutorials. They don't go further then teaching
> > <% Response.Write("Hello World") %>
> > I also lack an official website with all ASP commands explained, like
> > you have php.net for PHP.
> > Anyway, here I go, this piece of code contains a bug:
> > If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> > Then (
> > left = "column_left_nl.html"
> > top = "top_nl.html"
> > )
> > Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> > lang2 = "fr") Then (
> > left = "column_left_fr.html"
> > top = "top_fr.html"
> > )
> > Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> > left = "column_left_eng.html"
> > top = "top_eng.html"
> > )
> > End If
> > There is no tutorial that explains me whether to use brackets or not
> > and which kind of brackets I should use. So, do I need all these
> > brackets?
> > And why is:
> > lang = "DUT"
> > a declaration, and a couple lines further a comparison?
> > I'm really confused, please help me out.
> > Greetz,
> > Barton
Severin,
A Select Case statement might be more readable.
Select Case lang2.ToUpper
Case "DUT", "NL"
left = "column_left_nl.html"
top = "top_nl.html"
Case "FRE", "FR"
left = "column_left_fr.html"
top = "top_fr.html"
Case "ENG"
left = "column_left_eng.html"
top = "top_eng.html"
End Select
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Severin" <sev@.sevsamp.com> wrote in message
news:bie016$8h@.library2.airnews.net...
> I would write the code as such
> If lang2.ToUpper = "DUT" OR lang2.ToUpper = "NL" Then
> left = "column_left_nl.html"
> top = "top_nl.html"
> ElseIf lang2.ToUpper = "FRE" OR lang2.ToUpper = "FR" Then
> left = "column_left_fr.html"
> top = "top_fr.html"
> ElseIf lang2.ToUpper = "ENG" Then
> left = "column_left_eng.html"
> top = "top_eng.html"
> End If
>
> This is very readable to me, but then I learned .NET using VB not C#
> Severin
>
>
>
> "Barton" <bc173@.NOSPAMMMhotmail.com> wrote in message
> news:0sqkkvkb0764vl48nqv1fkql6nhb0fook5@.4ax.com...
> > Hello,
> > I just made to move to ASP. I have been developing in PHP the past two
> > years. I must say that I'm a little disappointed in the quality of the
> > beginners tutorials. They don't go further then teaching
> > <% Response.Write("Hello World") %>
> > I also lack an official website with all ASP commands explained, like
> > you have php.net for PHP.
> > Anyway, here I go, this piece of code contains a bug:
> > If (lang2 = "DUT" OR lang2 = "dut" OR lang2 = "NL" OR lang2 = "nl")
> > Then (
> > left = "column_left_nl.html"
> > top = "top_nl.html"
> > )
> > Else if (lang2 = "FRE" OR lang2 = "fre" OR lang2 = "FR" OR
> > lang2 = "fr") Then (
> > left = "column_left_fr.html"
> > top = "top_fr.html"
> > )
> > Else if (lang2 = "ENG" OR lang2 = "eng") Then (
> > left = "column_left_eng.html"
> > top = "top_eng.html"
> > )
> > End If
> > There is no tutorial that explains me whether to use brackets or not
> > and which kind of brackets I should use. So, do I need all these
> > brackets?
> > And why is:
> > lang = "DUT"
> > a declaration, and a couple lines further a comparison?
> > I'm really confused, please help me out.
> > Greetz,
> > Barton
Labels:
asp,
developing,
disappointed,
if-then-else,
net,
newsbie,
php,
quality,
twoyears
Subscribe to:
Posts (Atom)