This action might not be possible to undo. Are you sure you want to continue?
NET page comprises of a series of steps like initialization, instantiation of controls, state management, the firing of event handler code, and the final stage of rendering. The following are the various stages a page goes through: Page Request The request page is either parsed or compiled, or fetched from the cache. Start Page properties like the Request and Response are set. The type of request is determined, specifically whether it is a new Request or it is a PostBack. Culturing properties are also determined via the pages ICulture property. Page Initialization All the controls on the given page are initialized with a UniqueID (please don’t confused this with the ID property as the UnqiueID is a unique, hierarchicial identifier which includes the server control’s naming container). Theming is also applied at this stage. Load If the current request is a PostBack, the data from the viewstate and control state is loaded to the appropriate properties of the controls. Validation The Validate method of all the validator controls are fired, which in turn sets the Boolean property IsValid of the controls. Postback Event Handling If the current request is a PostBack, all event handlers are called. Rendering ViewState data is saved for all the controls that have enabled viewstate. The Render method for all the controls is fired which writes its output to the OutputStream via a text writer. Unload Once the page has been rendered and sent, the Page’s properties are unloaded (cleanup time). So know you have a better understanding of the various stages of a ASP.NET pages life cycle, you should be aware that within each of the above stages there are events that you can hook into so that your code is fired at the exact time that you want it to. Event Wire-up is another important concept to understand. So Event wire-up is where ASP.NET looks for methods that match a naming convention (e.g. Page_Load, Page_Init, etc) , and these methods are automatically fired at the appropriate event. There is a page level attribute AutoEventWireup that can be set to either true or false to enable this behaviour. Below are some of the more popular events that you should understand as you will most likely be interested in them: PreInit You can use this event to: Create /recreate dynamic controls Set a master page or theme dynamically Access profile properties Init Used to read or initialize your control properties. InitComplete Used when you need to access your properties after they have been initialized. PreLoad
Used when you need to process things before the Load event has been fired.
Load The Page’s OnLoad method and all of its child control’s OnLoad method are fired recursively. This event is used to set properties and make database connections Control Events Control specific events are handled at this stage. e.g. Click event’s for the button control. LoadComplete This stage is for when you need to access controls that have been properly loaded. PreRender Can be used to make any ‘last chance’ changes to the controls before they are rendered. SaveStateComplete This event is used for things that require view state to be saved, yet not making any changes to the controls themselves. Render The page object calls this method on all of the controls, so all the controls are written and sent to the browser. Unload All the controls UnLoad method are fired, followed by the pages UnLoad event (bottom-up). This stage is used for closing database connections, closing open files, etc. It is import to understand that each server control has its very own life cycle, but they are fired recursively so things may not occur at the time you think they do (they occur in reverse order!). What this means is that some events fire from the bottom up like the Init event, while others load from the top-down like the Load event. ASP.NET 2.0 – What’s New? Developer Productivity ASP.NET 1.0 was great, but as with most technologies there can always be room for improvement. One of the design goals of 2.0 was to help make the lives of developers easier. The ASP.NET team surveyed the common tasks one does during development, and encapsulated them into controls and services (which also helps reduce the number of lines of code!). These new controls encapsulate common tasks like user personalization, data access, memberships and roles and even navigation (think treeview, menus and yahoo like breadcrumbs). One thing that was custom coded in most web applications was common headers and footers on websites. ASP.NET 2.0 now comes with ‘master pages’ which gives you the ability to define common elements of your web page like headers, footers etc. Localization was also improved, allowing you to know auto-detect the visitors locale and display data accordingly. Dynamic generation of resource files is now a built-in tool with Visual Studios 2005. Configuration Management and General Administration Several new enhancements can be found in 2.0 that enable easier deployment, management and general operation of ASP.NET enabled servers. Configuration management APIs now give you the ability to read, update and even create web.config files. You can finally precompile your application before deploying it. Previously you had to either hit each and every page so ASP.NET compiles your site, or you used some sort of a tool that basically ‘walked’ your site to ensure the pages have been compiled. Performance 64-Bit support means ASP.NET can take advantage of the full memory address space on 64-bit cpu’s.
Caching has also been improved upon, now allowing the developer to set custom dependencies, post-cache substitution which improve your ability to custom your caching. Managing the cache is now even easier, with the ability to create ‘cache profiles’ and tweak a ‘cache configuration’. Basically what happens is that you create a cache profile which you can then use on your pages which allows you to manage caching on many pages by simply modifying your cache profile. For increased scalability, you can now set ‘SQL cache invalidation’ and ‘disk output cache’. SQL Cache Invalidation will cache the data until the data actually changes at the database level (as oppose to time based). Disk output cache will cache the data to disk (not only memory), thus allowing for more pages to be cached since you are not limited to your servers memory limit. Benefits of ASP.NET 2.0 include: 1) A wide array of new controls, such as GridView control, MultiView, Wizard and FileUpload. 2) Superior separation of design and content, enabling developers and Web designers to work together. 3) A new model for compiling and distributing applications. 4) Customization with Web Parts. 5) Master pages What are the new server controls added in Asp.net 2.0? Answer Navigation Controls: SiteMapPath, TreeView, Menu DataBindingControls: SqlDataSource, oledbDatasource, ObjectDataSource DataCotrols: GridView, DetailsView, FormsView What are Master pages? How to define a Master page? Answer ASP.NET master pages allow you to create a consistent layoutfor the pages in your application. A single master pagedefines the look and feel and standard behavior that youwant for all of the pages (or a group of pages) in yourapplication. You can then create individual content pagesthat contain the content you want to display. When usersrequest the content pages, they merge with the master page to produce output that combines the layout of the masterpage with the content from the content page. what are the sitemap providers in Asp.net 2.0? Answer SiteMapPath,TreeView and Menu controls why security trimming attribute? Answer It is used to hide links in site map what are the attributes of sitemapnode? Answer Title,url,description What is the use of Administration tool in Asp.net 2.0? Answer The ASP.NET version 2.0 membership feature provides securecredential storage for application users. It also provides amembership API that simplifies the task of validating usercredentials when used with forms authentication. Membershipproviders abstract the underlying store used to maintainuser credentials. ASP.NET 2.0 includes the following providers: * ActiveDirectoryMembershipProvider. This uses either an Active Directory or Active Directory Application Mode (ADAM) user store. * SqlMembershipProvider. This uses a SQL Server user store What are skins? Answer skin file is used to set the design settings of our htmlcontrols as well as web server controls .css file is used for html server controls .skin files are used for web server controls How to remove themes from certain controls? Answer Override the property EnableTheming by setting it to "False" for those controls
What is CSS? What is the advantage os using CSS in ASP.NET Web Applications? Answer CSS stands for Cascading Style Sheets. CSS is used to give a feel and look to the web pages, which will be unique throughout the application. In other words it's just like a thin layer above the webpage to give the web page a good appearance. What is the difference between User Controls and Master Pages Answer Both are code reduce features and reusability Purpose. When we create Masterpage that is common to overall project,whereas user controls these r used when we have requirement on specific criteria.Master page ex: INBOX,SPAM,DRAFT,TRASH etc in YAHOO WEBSITE Master pages and user controils are two different concepts. Master pages are used to provide the consistent layout and common behaviour for multiple pages in your applications.then u can add the Contenetplaceholder to add child pages custom contenet. User Controls: Sometimes u need the functionality in ur web pages which is not possible using the Built-In Web server controls then user can create his own controls called user controls using asp.net builtin controls.User controlsn are those with .aspx extensions and u can share it in the application. What is difference b/w Data Grid in ASP.Net 1.1 and Gridview in 2.0 Answer Gridview is the replacement in .net 2.0 for the datagrid. the differences between them is >>sorting editing and paging are the additional capabilities in gridview which requires no coding while Datagrid requires the user coding .Gridview has improved data binding using smart tag. Additional column types and design time column operations. Customised pager UI using pager template. Customized paging support. Datagrid has itemdatabound event but in gridview it is replaced by rowdatabound. In datagrid u can show more than one table with their relation while not possible in gridview. What are generics? why it is used? architecture of ASP.NET? Answer Generics are new in .NET 2.0.It is used to define a type while leaving some details unspecified.Generics are thereplacement of "Objects" in .NET1.1 Generics reduces the run-time error and increases the performance. Bug in ASP.NET 2.0:If you have a control on a page that is marked Read-Only and EnableViewState is set to false on the Page, the ReadOnly value will no longer post back in ASP.NET 2.0 - the value gets lost. This even though the value is actually returned in the POST buffer. This behavior is also different than 1.1 which (correctly I say) posted back the READONLY value. In 2.0 we can use both vb and cs code in same project.example we use utiltity or function written in vb can be used in cs code also. How many types of session in asp.net2.0 Answer ASP.NET pages typically post back to themselves in order to process events. Cross Page posting enables us to submit a form and have this form and all its control values posted to another page.The control which posts the page and all the control values it contains has PostbackURL property. And the receiving page uses PreviousPage property and the PreviousPageType page directive to access the posting page values Three types of session states in asp.net InProc OutProc SqlServer
Master Pages in ASP.NET 2.0 Master Pages enables you the developer to create a consistent look and feel for your web application. For most of us, we either create a header and footer on each and every webpage or we create a header and footer control and then add those controls to each and every .aspx page. Ofcourse some might have seen the pitfall in this method and weaved their own custom page that dynamically adds both the header and footer to their pages automagically. A master page is similar to a ‘.aspx’ page except that it has its own unique extension, ‘.master’. Furthermore, a master page contains a new ‘Master’ directive, along with a ContentPlaceHolder control. The ‘master’ directive tells us that this page is a master page, and the ContentPlaceHolder control is a placeholder (as the name suggests) for a content area where your content pages will ‘inject’ their content into the template. Keep in mind your master page can contain multiple ContentPlaceHolder tags, your content pages will simply reference the ID of the ContentPlaceHolder to ensure the content is injected into the correct area of the template. So putting this knowledge to work, let’s create a very simply Master Page: <%@ Master Language=”C#” %> <script language=c# runat=server> // your code here you wish! </script> <html> <head><title>Master Pages Tutorial on CSharpFriends!</title> <body> <form runat=server> <asp:ContentPlaceHolder ID=”ContentPlaceHolder1” runat=”server”> <h1>Look Mom, default content that will render only if not overridden on the content page!</h1> </asp:ContentPlaceHolder> </form> </body> </html> So you will notice the master page has that master directive I mentioned earlier, along with the ContentPlaceHolder. You will notice that within the ContentPlaceHolder control there is some content. This content will render in any content page that doesn’t reference this ContentPlaceHolder’s ID, so in effect you can have default content on all your content pages which is overridden if you have content. Once you have your master page, you obviously want to create content pages using your master page as a template. Your content page will be like any other .aspx page you have created in the past, except that it will reference the master page in the Page Directive and it will contain a Content Control and between this control will be all your content or at least the all the content for the corresponding ContentPlaceHolder contron in your master page. <%@ Page Language=”C#” MasterPageFile=”~/csharpfriends.master” %> <asp:Content id=”content1” ContentPlaceHolderID=”ContentPlaceHolder1” runat=”server”> <h1>Look Mom, actual content on my content page! Looks like I’m going to make it after all!</h1> </asp:Content>
As I mentioned earlier, your master page can contain numerous content areas using ContentPlaceHolder controls, just make sure to match up the ContentPlaceHolder’s ID in your pages. Basically want happens is that when your .aspx page renders, it will cycle through all the Content controls and match up the PlaceHolder in the master page. Master Page Configuration Options As it is now, it is possible to create content pages that don’t use the master page by simply NOT referencing the master page. This could be something you want, or it could be something you don’t want. To force pages to use the master page layout you can modify you web.config file by adding this XML tag. Keep in mind that even though a master page is forced on all pages, if the .aspx page references another master page file it will override your web.config settings. <configuration> <system.web> <pages masterPageFile=”csharpfriends.master” /> </system.web> </configuration>