VS.Net color coding bugs with inline code

Discussion in 'ASP .Net' started by Jon Maz, Oct 11, 2004.

  1. Jon Maz

    Jon Maz Guest

    Hi,

    I am writing inline code .aspx pages using VS.Net 2002. The color coding
    seems to work for VB.NET inline, and not for C# inline (see below).

    Does anyone know how to get this working for C#?

    TIA,

    JON




    ------------------------------------------

    <%@ Page Language="C#" %>

    <script runat="server">

    private void Page_Load(object sender, System.EventArgs e)
    {
    //color coding doesn't work - this line is black
    }

    </script>


    ------------------------------------------


    <%@ Page Language="VB" %>

    <script runat="server">

    Sub Page_Load(sender as Object, e as EventArgs)
    'color coding works - this line is green
    End Sub

    </script>


    ------------------------------------------
    Jon Maz, Oct 11, 2004
    #1
    1. Advertising

  2. Hi,

    Color coding is supported for VB only. See:

    http://msdn.microsoft.com/library/e...ithSingle-FileWebFormsPagesInVisualStudio.asp

    Greetings
    Martin
    "Jon Maz" <> wrote in message
    news:...
    > Hi,
    >
    > I am writing inline code .aspx pages using VS.Net 2002. The color coding
    > seems to work for VB.NET inline, and not for C# inline (see below).
    >
    > Does anyone know how to get this working for C#?
    >
    > TIA,
    >
    > JON
    >
    >
    >
    >
    > ------------------------------------------
    >
    > <%@ Page Language="C#" %>
    >
    > <script runat="server">
    >
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    > //color coding doesn't work - this line is black
    > }
    >
    > </script>
    >
    >
    > ------------------------------------------
    >
    >
    > <%@ Page Language="VB" %>
    >
    > <script runat="server">
    >
    > Sub Page_Load(sender as Object, e as EventArgs)
    > 'color coding works - this line is green
    > End Sub
    >
    > </script>
    >
    >
    > ------------------------------------------
    >
    >
    >
    >
    >
    Martin Dechev, Oct 11, 2004
    #2
    1. Advertising

  3. Jon Maz

    Jon Maz Guest

    Whaaaaaaaaaaaaaaat?!?!? I hope that makes sense to *someone* out there,
    'cos it don't make much sense to me....

    Ah well, thanks for letting me know, Martin.

    :-(

    JON

    PS Don't suppose anyone knows a workaround?
    Jon Maz, Oct 11, 2004
    #3
  4. It works (sort of) in VB simply by accident. Technically neither VS 2002 nor
    VS 2003 support coloring or intellisense in inline code. What you see is not
    VB color, it is vbscript color. Default server script language in *classic*
    ASP is vbscript and that's why <script runat="server"> is colorized using
    vbscript engine. You can get colorization of C# using jscript engine by
    setting page default server script to jscript. Colorization will be odd
    though :)


    Thanks
    Mikhail Arkhipov (Microsoft)
    -- This post is provided 'AS IS' with no warranties and confers no rights.


    On 10/11/04 7:39, in article #FSgD$
    , "Jon Maz" <> wrote:

    > Whaaaaaaaaaaaaaaat?!?!? I hope that makes sense to *someone* out there,
    > 'cos it don't make much sense to me....
    >
    > Ah well, thanks for letting me know, Martin.
    >
    > :-(
    >
    > JON
    >
    > PS Don't suppose anyone knows a workaround?
    >
    >
    Mikhail Arkhipov (Microsoft), Oct 11, 2004
    #4
  5. Jon Maz

    Jon Maz Guest

    Hi Mikhail,

    Well, anything is better than nothing.... How *do* you change the default
    server script to jscript? I'm looking around and can't find the setting....

    Thanks,

    JON
    Jon Maz, Oct 12, 2004
    #5
  6. There are two ways, none of them perfect

    1. Temporary remove runat=server from the script block

    OR

    2. Temporary add language="javascript" to the script tag

    Don't forget to remove the change when you run the page. Bit of a hassle, I
    agree. Fortunately, upcoming VS 2005 provides full language support in
    server script blocks.

    Thanks
    Mikhail Arkhipov (Microsoft)
    -- This post is provided 'AS IS' with no warranties and confers no rights.

    On 10/12/04 2:18, in article #, "Jon Maz"
    <> wrote:

    > Hi Mikhail,
    >
    > Well, anything is better than nothing.... How *do* you change the default
    > server script to jscript? I'm looking around and can't find the setting....
    >
    > Thanks,
    >
    > JON
    >
    >
    Mikhail Arkhipov (Microsoft), Oct 12, 2004
    #6
  7. Jon Maz

    Jon Maz Guest

    Hi Mikhail,

    Mmm, you're right, that is a bit of a hassle...

    Do you know if the setting that makes VBScript the default server script
    language is hard-coded in a file somewhere in C:\Program Files\Microsoft
    Visual Studio .NET, and could therefore be changed?

    Cheers,

    JON


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.775 / Virus Database: 522 - Release Date: 08/10/2004
    Jon Maz, Oct 12, 2004
    #7
  8. It is hardcoded :-(

    Thanks
    Mikhail Arkhipov (Microsoft)
    -- This post is provided 'AS IS' with no warranties and confers no rights.

    On 10/12/04 14:13, in article #, "Jon
    Maz" <> wrote:

    > Hi Mikhail,
    >
    > Mmm, you're right, that is a bit of a hassle...
    >
    > Do you know if the setting that makes VBScript the default server script
    > language is hard-coded in a file somewhere in C:\Program Files\Microsoft
    > Visual Studio .NET, and could therefore be changed?
    >
    > Cheers,
    >
    > JON
    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.775 / Virus Database: 522 - Release Date: 08/10/2004
    >
    >
    Mikhail Arkhipov (Microsoft), Oct 13, 2004
    #8
  9. Jon Maz

    Jon Maz Guest

    Hi Mikhail,

    One trick I use with VS.Net is to set the Page Layout in design mode to
    FlowLayout instead of GridLayout, using the following hack:

    C:\Program Files\Microsoft Visual Studio .NET 2003\
    VC#\VC#Wizards\CSharpAddWebFormWiz\Templates\1033\WebForm1.aspx

    Change the body tag from:
    <body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">
    to:
    <body MS_POSITIONING="FlowLayout">

    Just to check - you're saying there is *no* equivalent hack for changing the
    default server script language to jscript?

    Thanks for all the help,

    JON
    Jon Maz, Oct 13, 2004
    #9
  10. You don't have to use hacks to set page layout to flow, just right click on
    project node in Solution Explorer, choose Properties | Web settings and set
    default page layout to flow :)

    However, vbscript default for ASP is hardcoded in C++ logic since this
    default never changes and it was not necessary to add extra flexibility.
    Colorizer simply assumes that if page is server-type and language attribute
    is missing or unrecognized, the language is vbscript.

    On 10/13/04 2:09, in article , "Jon
    Maz" <> wrote:

    > Hi Mikhail,
    >
    > One trick I use with VS.Net is to set the Page Layout in design mode to
    > FlowLayout instead of GridLayout, using the following hack:
    >
    > C:\Program Files\Microsoft Visual Studio .NET 2003\
    > VC#\VC#Wizards\CSharpAddWebFormWiz\Templates\1033\WebForm1.aspx
    >
    > Change the body tag from:
    > <body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">
    > to:
    > <body MS_POSITIONING="FlowLayout">
    >
    > Just to check - you're saying there is *no* equivalent hack for changing the
    > default server script language to jscript?
    >
    > Thanks for all the help,
    >
    > JON
    >
    >
    >
    >
    Mikhail Arkhipov (Microsoft), Oct 14, 2004
    #10
  11. Jon Maz

    Greg Burns Guest

    > However, vbscript default for ASP is hardcoded in C++ logic

    I thought I heard VS.NET was built with C#? Or are you referring to
    something else?

    Greg
    Greg Burns, Oct 14, 2004
    #11
  12. VS, including VS 2005 is COM/OLE based and is 80% C++. Just look at amount
    of native code dlls compared to managed assemblies. It is way too expensive
    to rewrite in another language. Property grid is managed, parts of Web Form
    editor, XML schema and Data designers, a few other things. VS 2005 has a bit
    more C#: new XML editor, build subsystem, team server, new Enterprise tools.
    However, majority is still C++. Typically new components tend to be managed,
    legacy parts remain native.

    My team owns HTML editor, btw.

    Thanks
    Mikhail Arkhipov (Microsoft)
    -- This post is provided 'AS IS' with no warranties and confers no rights.

    On 10/13/04 16:57, in article , "Greg
    Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote:

    >> However, vbscript default for ASP is hardcoded in C++ logic

    >
    > I thought I heard VS.NET was built with C#? Or are you referring to
    > something else?
    >
    > Greg
    >
    >
    >
    Mikhail Arkhipov (Microsoft), Oct 14, 2004
    #12
  13. Jon Maz

    Greg Burns Guest

    > My team owns HTML editor, btw.

    Then I'll take your word for it. :^)

    Greg
    Greg Burns, Oct 14, 2004
    #13
  14. I noticed in VS 2005 that ASP 2.0 color-coding was removed.
    I still have VS .NET 2003 installed and the syntax is color-coded.

    How can I add the syntax color-coding back to the .asp pages in VS .Net 2005?

    "Greg Burns" wrote:

    > > My team owns HTML editor, btw.

    >
    > Then I'll take your word for it. :^)
    >
    > Greg
    >
    >
    >
    =?Utf-8?B?QnJldHQgTWF0aGU=?=, Oct 18, 2004
    #14
  15. You can't, it's simply broken in Beta 1. I fixed it couple of weeks ago, it
    should be working properly in Beta 2.

    Thanks
    Mikhail Arkhipov (Microsoft)
    -- This post is provided 'AS IS' with no warranties and confers no rights.

    On 10/18/04 11:01, in article
    , "Brett Mathe" <Brett
    > wrote:

    > I noticed in VS 2005 that ASP 2.0 color-coding was removed.
    > I still have VS .NET 2003 installed and the syntax is color-coded.
    >
    > How can I add the syntax color-coding back to the .asp pages in VS .Net 2005?
    >
    > "Greg Burns" wrote:
    >
    >>> My team owns HTML editor, btw.

    >>
    >> Then I'll take your word for it. :^)
    >>
    >> Greg
    >>
    >>
    >>
    Mikhail Arkhipov (Microsoft), Oct 19, 2004
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hassan Latif

    Inline coding in ASP.NET using C#

    Hassan Latif, Nov 25, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    764
    Cowboy \(Gregory A. Beamer\)
    Nov 25, 2003
  2. Newbie \(C#,Asp.net\)

    code behind or inline-coding

    Newbie \(C#,Asp.net\), Nov 10, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    6,072
    Kevin Spencer
    Nov 10, 2004
  3. calmar
    Replies:
    11
    Views:
    785
    calmar
    Feb 21, 2006
  4. Josef 'Jupp' Schugt

    Still use 'ruby-bugs' for Ruby bugs?

    Josef 'Jupp' Schugt, Nov 4, 2004, in forum: Ruby
    Replies:
    2
    Views:
    160
    Tom Copeland
    Nov 4, 2004
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    405
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page