Maulik Soni

<ASP:MSLOG runat=”brain”>

  Home  |   Contact  |   Syndication    |   Login
  4 Posts | 13 Stories | 14 Comments | 3 Trackbacks

News

Article Categories

Archives

Post Categories

Book List

My Contribution

Wednesday, February 22, 2006 #

Creating a new Project - The process of creating new files and projects within Visual Studio 2005 is different from the process using Visual Studio 2003. In the latest release of Visual Studio 2005 the focus on project based application is gone. Now projects are created in a page-based manner. This means that when you first create the application, the only items created for you by the IDE are the project folder and a single .aspx file.


Making References to Other Objects- when you look at the Solution explorer of your ASP.NET application,notice that the References and Web References folders are not present. You can add them using following ways.

  • Select the project in Solution Explorer then choose Web Site -> Add References or Add Web References

  • Right Click the project name in solution explorer and select project properties.


Smart Tags


Saving and Importing Visual Studio 2005 Settings - Visual Studio 2005 allows you for a tremendous number of customizations and modifications to the development environment. To save your settings Tools -> Import Export Settings. From this wizard you can save your settings to a file that can be used elsewhere or you can import settings that are stored in the same type of file. The file has .vssettings extension.


Validating your HTML – accessibility validation.


Reaching out to a Community- The Community section adds a new menu bar item in Visual Studio 2005.THe section allows you to reach beyond your local computer. The available options for this menu included the following:

  • Ask a question

  • Send feedback

  • Check question status

  • Developer Center

  • Codezone Community

  • Community Search


Working with Snippets – Visual Studio 2005 now includes a rather large collection of code snippets for you to freely use within your code. Snippets are little peace of code that perform a specific task.


To insert a snippet in your code, right click on code window and select Code Snippets.


You can manage snippets through Tools -> Code Snippets Manager. You can add/remove snippets used by Visual Studio 2005. Visual Studio includes my snippets folder in which you can place your own snippets. Snippet is a single .snippet file you can find the .snippet file at c:\program files\Microsoft visual stdio 8\vb\snippet\1033.


From this location you can add your own categories,but you have to sure to add this new folder to the sinppetindex.xml file found at the same location in order for your folder to be recognize by Visual Studio 2005.

In ASP.NET 2.0, there are several of directories under your project that have special significance. They are:

 

App_Code

 

The App_code folder is a container for class files and WSDL and XSD documents. All files contained within this folder are automatically compiled during runtime

 

App_Data

 

The App_Data folder is used to contain database files as well as XML and schema files

 

App_LocalResources

 

The App_LocalResources folder stores the resource files generated by Visual Studio to be used for implicit localization.

 

App_GlobalResources

 

The App_GlobalResources folder is used to store resource files required for globalization. Note that the resource files(.resx) placed in this folder are automatically exposed via the Resource class, providing intelligence statement completion for the resource contained within.

 

App_Themes

 

The App_Themes folder stores themes and skins files

 

App_Browsers

 

The App_Browsers folder is used to store browser files for supporting different types of clients.

 

App_webReferences

 

The App_webReferences folder stores .wsdl and .discomap files of web service.

Maulik Soni


Saturday, February 25, 2006 #

This post discuss about general ASP.NET 2.0 application and page framework.

Application Location Options- With ASP.NET 2.0 you have the options to create an application with followings:

  • File System – uses Visual Studio 2005 development server
  • Local IIS – uses IIS as web application server
  • FTP Site
  • Remote Site

Page Structure Options – ASP.NET 2.0 provides two paths fro structuring the code of your application.

  • Code Inline Model – All the code contained in a single aspx file
  • Code Behind Model – Code separation of the page's Business Logic from its presentation logic. Business logic is stored in .aspx.vb file whereas presentation logic stored in aspx file.

To code as InLine coding – while you create a new project don't check "put this code in separate file. Now in Visual Studio 2005 inline coding also supports intelli Sence.

New Code Behind model – select 'place code in separate file" checkbox.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default"%>

The aspx page using the new ASP.NET 2.0 code behind model has some attributes in page directive different from those in ASP.NET 1.x.

CodeFile = Point to the code behind file which is used with this presentation page. In this case default.aspx.vb.

Inherits = this attribute was available in previous version of ASP.NET 1.x but very little used. The attribute specifies the name of the class that is bound to the page when the page is compiled.

The followings are the ASP.NET 2.0 page directives. ( for more info pl. loot at msdn)

  • @Page
  • @Master
  • @Control
  • @Import
  • @Implements
  • @Register
  • @Assembly
  • @PreviousPageType
  • @MasterType
  • @Output Cache
  • @Reference

 

 

ASP.NET 2.0 Page Events

Page Events – The followings are the new page events supported by ASP.NET 2.0

  • InitComplete - Indicates the initialization of the page is completed
  • LoadComplete – Indicates the page has been completely loaded into memory.
  • PreInit – Indicates the moment before a page has been loaded into memory.
  • PreRenderComplete – Indicates the moment directly before a page has been redirected in the browser.

The order of PAGE EVENTS

  1. PreInit
  2. Init
  3. InitComplete
  4. PreLoad
  5. Load
  6. LoadComplete
  7. PreRender
  8. PreRenderComplete
  9. Unload

Dealing with POSTBACK – in ASP.NET 1.x pages typically posted back to themselves in order to process events. For this reason you must differentiate between post for the first time a page is loaded by the end user and POSTBACK. Then you use either

If Page.IsPostBack=True then

'Do processing

End If

or

If Not IsPostBack then

'Do processing

End If

Cross Page Posting- In many cases developer wants that ability to post to another page and deal with the first page's control values on the page. This is now possible in ASP.NET 2.0 and it is quit simple propcess.

Example using Previouspage.FindControl method

  1. Create page1.aspx with textbox and 2 button control
  2. On 2nd button set text property = "post back to page2"
  3. Go to property window (F4) and locate PostBackURL propery of 2nd Button Control - and set it to"page2.aspx"
  4. Now create a Page2.aspx
  5. in page load event write followings:

dim pp_textbox1 as textbox

pp_textbox1=ctype(PreviousPage.FindControl("Textbox1"),textbox)

response.write(pp_textbox1.text)

Example using Public Property-

  1. in page 1 create public read only properties
  2. Public ReadOnly Property pp_TextBox1() as TextBox

    Get

    Return TextBox1

    End Get

    End Property

  3. Consuming the exposed properties from page1
  4. go to page2 SourceView
  5. Add followings
  6. <%@ PreviousPageType VirtualPath="page1.aspx"%>
  7. in page_load event write
  8. Response.write(PreviousPage.pp_TextBox1.text)

now, if the user directly request page2 – then previouspage will have null values. To prevent this error

use

ISCROSSPAGEPOSTBACK property.

Maulik Soni


Tuesday, February 21, 2006 #

 

 


A quick tour to Visual Studio 2005 IDE.


Start Page – is the first page that you will see when you pull up VS2005 for the first time. If you close the start page, you can reactive it by View->Start Page.


Views in the Document window – VS2005 offers two views of a page. Design and Source. Source view is the default view in VS2005. By using options dialog you can change the default view visual studio uses when a page is opend for the first time. Choose Tools -> Options and navigate to the HTML Designer section. ( if you can not see the HTML designer tab check the show all settings checkbox)


Tag Navigator – when you are working visually with an asp.net page notice that a list of elements appears at the bottom of the document window. This elements are called tag navigators. Instead of requiring you to select the element from the design surface or from within source view, the tag navigators enables you to right click an element to select it and display properties for that control in properties window.


Page Tabs- whenever a document is open in the window, a tab for that page appears on the top of the window. Right click on the page tab gives you the new options: Save, Close, Close all but this, Copy full path, open containing folder.


Code Change Status Notification – Document window now includes a new code-change notification system. Line numbers are included by default. Click on any number will highlight that line. Next to the line number is changing color bar. The color bar notifies you of the code changes that have occurred on your ASP.NET pages. If no color is appeared on that line – you have not yet made any changes to that file. After you make a change to perticular line a yellow bar appears. After a file is saved, the line appears to be green.


Error notification and Assistance – in Visual Studio 2005 design time error checking is continues, in addition to you will now see a small square at the end of error code line, hovering the cursor to that square causes an error sign to appear. Clickin the error sign opens a dialog that gives you option for fixing the error.


The ToolBox – The tool box is now divided in sub parts. It has standard, data, validation, navigation, login, webparts, HTML and General Tabs. To view the controls on toolbox as icon – right click on toolbox and un check view as list.


Solution Explorer – solution explorer has following items displayed as icon on the top. First is properties, Refresh, Nested Related Files, View Code, View Designer, Copy Web Site, ASP.NET.Configration.


Server Explorer - Server explorer enables you to perform number of functions such as working with database connectivity, monitoring, performance and interacting with event logs.


Properties window – unchanged from vs2003


Maulik Soni


Monday, February 20, 2006 #

 The Goals of ASP.NET 2.0

 

Developer productivity – Eliminate much of the tedious coding that ASP.NET originally required and to make common ASP.NET Task easier. Take an example, in ASP.NET 1.x you need to write number of lines code to just enable paging in datagrid control. Now you can just specify “AllowPaging=True”.

 

Administration and Management -This release of ASP.NET focus on the developer, and little thought was given to the people who had to administrator and manage all the ASP.NET application that were built and deployed. ASP.NET has now includes a Website Administration Tool, to facilitate web site administrator to edit ASP.NET Configuration settings. This tool allows administrator to edit the content of machine.config and the web.config file directly. Even you can access this tools programatically using the API calls – that are now part of .NET Framework 2.0. Now you can also encrypt the section of your config files.

 

Performances and Scalability- One of the goal from ASP.NET team was to provide the world's fastest web application server. One of the most exciting performance enhancement is the new caching capability aimed at exploiting Microsoft SQL Server 2005. ASP.NET now includes a feature called Sql cache invalidation.

 

Additional New Features -

New Development Infrastructure

Membership and Role Management

Personalization

ASP.NET Portal Framework

Site Navigation

New Compilation System

Addition to the Page Framework – Master Pages

Themes and Skins

New Objects for accessing Data

New Server Controls

New IDE for building ASP.NET 2.0 Pages


 

Maulik Soni