|
The first thing to look at is errors that happen during compilation. Since ASP.NET pages are compiled when they are run, this can be fairly alarming when you first see it, but don't worry. If we go by my experience, most of these will just be typing errors!
Create a new ASP.NET Page, called CompileError.aspx.
Add a Label and a Button to the page.
Double-click the button to get to the code window, and type the following in:
Label1.Test = "Some Text"
Type it in exactly as it is here – there's a deliberate error.
Save the page and run it:
Well, it's somewhat obvious what's wrong from the error message:
'Test' is not a member of 'System.Web.UI.WebControls.Label'.
We simply mistyped the property name, using Test instead of Text. However, what's important is seeing what happens and understanding the error. On the above screen you can see the source code is shown with the line containing the error highlighted. There are two links on the page that allow us to see more detailed information – you can click them if you like, but for most errors you'll find the default details give enough information. We're not going to look at these here, but the .NET documentation has more details on them.
Fixing the error is simply a matter of correcting the typing mistake and trying again.
|