Technical Training
ASP.NET 2.0ASP.NET Code Directory Page - 2
ASP.NET Code Directory
.
.
Ads
To create a component in the Application_Code folder
1. In Solution Explorer, right-click the Application_Code folder, and then click Add New Item.
2. Under Visual Studio installed templates, choose Class.

3. Name the class ExForSysClass1.
4. From the Language list, select C#.
5. Click Add.
Visual Web Developer opens the new class file in the editor.
1. Create a class that has a single property named testString.
public class ExForSysClass1
{
..........public ExForSysClass1() {}
..........private string testStringValue;
..........public string testString
..........{
....................get
....................{
..............................return testStringValue;
....................}
....................set
....................{
..............................testStringValue = value;
....................}
..........}
}
2. Save the file and close it.
Using the Component
1. Create a file called ExForSys.aspx
2. From the Standard folder of the toolbox, drag a TextBox control, Label control, and Button control onto the page.
3. Double-click the button to create a Click handler it.
4. In the handler, type in the code just below the page directive.
< script runat="server" language=C# >
..........void Button1_Click(object sender, EventArgs e)
..........{
....................ExForSysClass1 Test = new ExForSysClass1();
..............................Test.testString=TextBox1.Text;
........................................Label1.Text=Test.testString;
..........}
< / script >
5. When you enter a space after New or new, Visual Web Developer displays a list of available classes. The class you created earlier, ExForSysClass1, appears in the drop-down list.

Testing the Page and Component
1. Press CTRL+F5 to run the page.
2. When the page appears in the browser, enter something into the text box and click the button. Doing so sets a property in your simple class, which is then displayed in the Label control.

Navigate to Windows Explorer and examine the directory in which the Website is located. Note that the page App_code directory and the .aspx files appear in the website folder. Also note that the .dll file is not present in the directory. ASP.NET has compiled the page and the component dynamically.
ASP.NET 2.0
- Getting started with ASP.NET 2.0
- .NET Framework Fundamentals
- Microsoft.NET Framework Tools
- Application Development in .NET
- What's New in the .NET Framework 2.0 ?
- Introduction to Visual Studio.NET
- Installing Visual Studio.NET 2005
- Working with Visual Studio.NET Web Applications
- Whats New in ASP.NET 2.0
- Creating an ASP.NET Application
- ASP.NET Code Directory
- ASP.NET Page Object Model
- ASP.NET Server Controls
- ASP.NET Working With Master Pages
- ASP.NET Creating Content for Master Page
- ASP.NET Referencing Master Page Members
- ASP.NET Changing Master Pages Dynamically
- ASP.NET Creating Nested Master Pages
- ASP.NET Working with Web Parts
- ASP.NET Using Web Parts and Controls in Web Pages
- ASP.NET Web Pages and Layout
- ASP.NET - Adding Web Parts at Run Time
- ASP.NET Personalization: User Profiles and Themes
- ASP.NET Data Access features
- ASP.NET State Management
- ASP.NET Customizing the Session State Mechanism
- ASP.NET State Management And Caching
- ASP.NET Security
- Forms Authentication in ASP.NET
- ASP.NET Managing Membership and Roles
- ASP.NET Configuring Page-Level Caching
- ASP.NET Setting Application-Level Caching
- ASP.NET Data Source Object Model
- ASP.NET SqlDataSource Control
- ASP.NET Data Bound Controls
- ASP.NET GridView Control
- ASP.NET GridView Filtering
- ASP.NET Adding Sorting and Paging in GridView
- ASP.NET DataBound Controls - Details View
- ASP.NET Using a Grid to Display Detail Information
- ASP.NET Displaying Master-Detail Data on the Same Page
- Displaying Master-Detail Data on Separate Pages in ASP.NET
- ASP.NET Creating Web Wizards
- ASP.NET : Dynamic Image control
- ASP.NET Advanced Site Functionality







