Professional Web Applications Themes

newsbie if-then-else question - ASP.NET General

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 = ...

  1. #1

    Default 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,

    Barton
    Barton Guest

  2. #2

    Default Re: newsbie if-then-else question

    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" <com> wrote in message
    news:com... 


    Frank Guest

  3. #3

    Default Re: newsbie if-then-else question

    Go to http://codemaster.digitalrice.com and check the ASP section for
    beginners tutorial

    "Barton" <com> wrote in message
    news:com... 


    Arsalan Guest

  4. #4

    Default Re: newsbie if-then-else question

    I use them to be more clear

    "Barton" <com> wrote in message
    news:com... 


    MS Guest

  5. #5

    Default Re: newsbie if-then-else question

    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"
    <com> wrote:
     
    >[/ref]

    Barton Guest

  6. #6

    Default Re: newsbie if-then-else question

    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"
    <com> wrote:
     
    >[/ref]

    Barton Guest

  7. #7

    Default Re: newsbie if-then-else question

    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" <com> wrote in message
    news:com... 


    Severin Guest

  8. #8

    Default Re: newsbie if-then-else question

    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" <com> wrote:
     
    >[/ref]

    Barton Guest

  9. #9

    Default Re: newsbie if-then-else question

    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" <com> wrote in message
    news:bie016$airnews.net... 
    >
    >[/ref]


    S. Guest

Similar Threads

  1. Replies: 9
    Last Post: April 27th, 04:44 AM
  2. Pen Tool Use Question. (Embarrassingly Newbie Question)
    By Bozo Schmozo in forum Macromedia Flash
    Replies: 0
    Last Post: November 12th, 10:00 PM
  3. regexp question + html::pr question on the side
    By boris in forum PERL Miscellaneous
    Replies: 4
    Last Post: September 27th, 02:24 AM
  4. newB question: related tables question
    By Blue man in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: June 30th, 04:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139