Solved

Early Binding in ASP.NET?

Posted on 2002-06-26
6
448 Views
Last Modified: 2012-05-04
Pardon my ignorance, but I have to ask.

It would help tremendously if I had intellisense in my ASP.NET pages.  I don't mean the HTML tags but the scripting tags.

For example:

suppose you have a sub like this

sub page_load(Sender As Object, E As EventArgs)
    Message.Text = "You last accessed this page at: " & DateTime.Now
end sub

and you have an object on your form called Message like this:

<asp:label id="Message" font-size="24" font-bold="true" runat="server" />

Ok now, why can't I get intellisense on the page_load sub?

ie. Message.Text or DateTime.Now??

Is it a early binding issue?  If this can be done, is there someone that could help me with this?  Thanks
0
Comment
Question by:mleopard
  • 3
  • 3
6 Comments
 
LVL 4

Accepted Solution

by:
DarthPedro earned 50 total points
ID: 7111148
Are you using the code-behind feature in VS.NET, or putting all of the source code and asp.net tags in a single ASPX page?

Intellisense seems to work fine if you are using code behind.  As a matter of fact, if you drag-and-drop a web control from the toolbox onto the form everything gets setup correctly:  a protected member variable gets added to your Page object for each control on the page.  Then, using that object gives you the intellisense that you're looking for on your .CS

If you're not using the VS.NET wizards to create the ASPX pages, you won't get code-behind by default but you can turn it on manually as well.  If you're interested in doing that, let me know.
0
 

Author Comment

by:mleopard
ID: 7111364
Currently all my code is in the aspx file.  I will try the dropping and dragging feature and see if that will work.  I am so used to manually typing in the HTML that maybe an oversight was in the makings.  I will post back my results. Thanks for the response.
0
 

Author Comment

by:mleopard
ID: 7111378
Ok I still could not get Intellisense in the aspx file but it worked fine with the code behind.  I'll just go that route since it seems to be friendlier to use.  Thanks for your input and let me know if there is something else that I might be missing that would allow intellisense to work in an aspx page.  
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 4

Expert Comment

by:DarthPedro
ID: 7111382
You can still use the page-behind feature without using the drag-drop on the form (if you like typing in the HTML).  That feature just puts all of the page code into a .CS or .VB file and those editors have the intellisense feature.

If you put the following tag at the top of your page, you can create a separate file for your code:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="EETestApps.WebForm1" %>

The .CS file is the file where you place your code.  The EETestApps.WebForm1 property is the name of your page class.  Here is the starting code for the page class.

namespace EETestApps
{
     public class WebForm1 : System.Web.UI.Page
     {
          protected System.Web.UI.WebControls.DropDownList TestDropDown;

          private void Page_Load(object sender, System.EventArgs e)
          {
                 ...
                }
        }
}
0
 
LVL 4

Expert Comment

by:DarthPedro
ID: 7111384
I don't think the ASPX editor has intellisense, only the language editors.
0
 

Author Comment

by:mleopard
ID: 7111394
Thanks for the help.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question