My namespace disappear in ASP.NET 2(beta2)?

王朝asp·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

When you create your first ASP.NET 2.0 Web Page. You may say:"Oh!", there's no default namespace in your code-behind cs file? OK, let's add one, we think every object should be in one certain namespace. it's easy to add it, and then let's press F5 to run it. "What? Errors? I didn't do anything! just add a namespace!".

OK, calm down, let me explain it. When you add a namspace to you aspx.cs file. please turn to the corresponding aspx file. look at this:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

You see, current page is inherited from the _Default, it should be changed to MyNamespace._Default, right? add it, and press F5, OK, you got it, you first page run successfully! Congratulation!

There're so many different things between ASP.NET 1.1 and 2.0. I'm sure, and I'm a beginner. anyway, let's learn these things one by one.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航