Solved

Early Binding in ASP.NET?

Posted on 2002-06-26
6
446 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now