Intellisense not suggesting VB?

Denaes

Senior Contributor
Joined
Jun 10, 2003
Messages
956
Yeah, this is pretty minor and kinda silly, but when I type this line:

Visual Basic:
<script runat="server" language="VB">

and I get to the language tag, it suggests: ecmascript, javascript, jscript & vbscript.

I'm using VS2005 and following a book on learning ASP.Net. It's just annoying each time I try to type "VB" "vbscript" is inserted and I have to go back and delete it. In this case I do not have a page directive stating that I'm using VB, so the tag is required.

Thanks if anyone knows why.
 
Doesn't the language identifier for server-side code go in the page tags at the top of the code?...
Code:
<%@ Page [color=red]Language="vb"[/color] AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="playtime.WebForm1"%>
The script command you're using there will handle ordinary VBScript ... but I'm no expert...
 
Whoops. Sorry. I thought the term would be familiar in this forum.

OOT = Out Of Topic.

I'm using OOT since I'm asking something not relevant to the thread's main discussion.
 
Script tags

If you read Denaes' post properly:

I'm using VS2005 and following a book on learning ASP.Net. It's just annoying each time I try to type "VB" "vbscript" is inserted and I have to go back and delete it. In this case I do not have a page directive stating that I'm using VB, so the tag is required.

Normally a Page directive would suffice, but in this case Denaes is not using one so the tag is required.

Back to Denaes' question, I would say this is an unfortunate lacking in the IDE (not really a bug). As for why it is, I expect that it's just something the IDE developers forgot to include. Many of the samples in MSDN use the script tag in this way, so it is definitely supported, but I suppose the vast majority of the time the script tag will be used for Javascript or VBScript. Either way I doubt there is much you can do about it.

Even though you're following a book tutorial, you could probably still use a Page directive as it shouldn't make much difference to what the book is demonstrating. This will allow you to use the <% %> tags to enclose ASP.Net code, and is definitely a better way to do things. However, I would suggest you avoid codebehind until you have the basics down.

Good luck :cool:
 
Cool, good to know. Thanks for the info :)

I'm beyond that, normally using a code behind file now as well.

I guess the book was trying to keep things simple early on.

One thing I noticed when they first talked about the <script> tags and assigning a language there as well as in the page directive, my first thought would be that it would be mad cool to have a VB & C# tags in the same page, but the book says that you can only choose one language.

so if you have VB as your page directive, you can't do a script block of C#.

Can you mix it up with Javascript or one of the intellisense supplied scripting languages? Like have a VB Page and insert a JScript Script block?
 
Re: Script tags

However, I would suggest you avoid codebehind until you have the basics down.

This is interesting. I always thought it would be a best practice to use codebehind instead. That way your .aspx will be clean from programming codes.

Mind explaining your reason MrPaul?
 
Regardless of the server side choice of language (vb or C#) you can still use client side scripting such as JavaScript as VS should provide intellisense etc. for it as well.
 
Codebehind for dummies

This is interesting. I always thought it would be a best practice to use codebehind instead. That way your .aspx will be clean from programming codes.

Mind explaining your reason MrPaul?

Ideally all code would be in a seperate file. In practice this is difficult to achieve with all but the most basic pages - if you need to do anything fancy with databinding then your code will probably be peppered with small code fragments. I am aware than in any scenario it will be possible to have 100% of the code in a codebehind file, but this is often impractical, and can make code harder to read/maintain, not easier.

On the contrary, placing code directly into the .aspx page means it performs logically - i.e. where you place a Response.Write is pretty much exactly where the output will appear. Compare this to codebehind's event-based approach. While learning ASP.Net (as Denaes is doing), and especially when following a book which doesn't use codebehind, I recommend avoiding it until you have the basics down. ASP.Net is such a huge and beast that learning is best taken in small steps.

Finally, codebehind is even less intuitive to those who program in legacy ASP, PHP, Perl, etc. At the end of the day your primary goal is learning how ASP.Net works as a whole - worrying about where the code is placed is secondary.
 
Re: Codebehind for dummies

What is ideal is not always practical. Right? :D

Personally I wanted a clean code using codebehind. But as MrPaul said, I find it hard to do especially when dealing with complex databinding.
 
Re: Codebehind for dummies

This is all quite interesting, as I'm a newbie to this, and have dealt mainly with Windows apps till now. Could you give some eamples of what would constitute advanced data binding, please?


Many thanks,
Paul.
 
Re: Codebehind for dummies

This is all quite interesting, as I'm a newbie to this, and have dealt mainly with Windows apps till now. Could you give some eamples of what would constitute advanced data binding, please?

Complex. Not advance.

AFAIK the term simple databinding refers to binding mechanism where you simply bind a database table column to a property of a control or a datagrid column.

So my definition of complex databinding would be binding mechanism where you need to do more than what I explained above.

For example you have column value it table xyz in your database. If you want it to be shown as is then it's simple data binding. You simply set the datasource and set which column to bind.

But if, for example, you want it to be shown using the color red if the content of value is less than or equal to (<=) 55 and green for bigger than (>) 55. In this case you'll need to add some code to your aspx page.

I hope that's clear enough. :p
 
Back
Top