Please navigate to the bottom of the page for Table of Contents

Friday, May 27, 2011

ASP.NET @ Page directive

Every ASP.NET generally begins with the @ Page directive. This defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files. By default, Visual Studio creates a page directive as shown below (when you use the default web application template):

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>


This directive can be used only in Web Forms pages. You can include only one @ Page directive per .aspx file. Further, you can define only one Language attribute per @ Page directive, because only one language can be used per page.The Page directive is made of many attributes. Let’s review a few of the important ones:


Title
Specifies a title for the page that is rendered within the HTML <title> tags in the response. The title can also be accessed programmatically as a property of the page.


Language
Specifies the language used when compiling all inline rendering (<% %> and <%= %>) and code declaration blocks within the page. Values can represent any .NET Framework-supported language, including Visual Basic, C#, or JScript. Only one language can be used and specified per page.


MasterPageFile
Sets the path to the master page for the content page or nested master page. Supports relative and absolute paths.


AutoEventWireup
Indicates whether the page's events are autowired. true if event autowiring is enabled; otherwise, false.


CodeBehind
Specifies the name of the compiled file that contains the class associated with the page. This attribute is not used at run time. This attribute is used for Web application projects. The CodeFile attribute is used for Web site projects.


Inherits
Defines a code-behind class for the page to inherit. This can be any class derived from the Page class. This attribute is used with the CodeFile attribute, which contains the path to the source file for the code-behind class. The Inherits attribute is case-sensitive when using C# as the page language, and case-insensitive when using Visual Basic as the page language.


If the Inherits attribute does not contain a namespace, ASP.NET checks whether the ClassName attribute contains a namespace. If so, ASP.NET attempts to load the class referenced in the Inherits attribute using the namespace of the ClassName attribute. (This assumes that the Inherits attribute and the ClassName attribute both use the same namespace.)


In addition to the attributes generated by default, you should also know about the following properties. They are a favorite of interviewers (they are either obscure, or ASP.NET 4 specific or they just like it).


ClientIDMode
Specifies the algorithm to use to generate ClientID values for controls. The default value is Predictable. The default value for controls is Inherit. Therefore, the default algorithm for controls in a page is determined by the ClientID setting of the page. A different default value can be set in the pages element of the Web.config file. For more information about the algorithms, see the ClientIDMode class.


ContentType
Defines the HTTP content type of the response as a standard MIME type. Supports any valid HTTP content-type string.


EnableEventValidation
Enables validation of events in postback and callback scenarios. true if events are being validated; otherwise, false. The default is true.


Page event validation reduces the risk of unauthorized postback requests and callbacks. When the enableEventValidation property is set to true, ASP.NET allows only the events that can be raised on the control during a postback request or callback. With this model, a control registers its events during rendering and then validates the events during the post-back or callback handling. All event-driven controls in ASP.NET use this feature by default.


It is strongly recommended that you do not disable event validation. Before disabling event validation, you should be sure that no postback could be constructed that would have an unintended effect on your application.


EnableSessionState
Defines session-state requirements for the page. true if session state is enabled; ReadOnly if session state can be read but not changed; otherwise, false. The default is true. These values are case-insensitive.


EnableViewState
Specifies whether view state is maintained across page requests. This value is true if view state is maintained, or false if view state is not maintained. The default is true.

102 comments:

  1. Thank you so much..i have to really helpful for your sharing information..

    Information Training in Chennai | Oracle DBA Training in Chennai

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. i gain the knowledge of and industry oriented coaching available from greens technology chennai in Adyar may visit.Sharepoint Training In Chennai

    ReplyDelete
  4. once again sharing this informative blog .It uses a graphical notation to construct data integration solutions and is available in various versions may visit greens technology chennai in adyaroracle dba training In Chennai

    ReplyDelete
  5. Very nice blogs!!! i have to learning for lot of information for this sites...
    android Training in Chennai | Oracle Training in Chennai

    ReplyDelete
  6. Latest Govt Bank Jobs 2016

    This is awesome blog with smart content, Nice to see your post. Thanks...........

    ReplyDelete
  7. What great post thanks for amazing sharing with lots of applications Company About Us

    ReplyDelete
  8. thanks for sharing this information..
    Best SEO training in hyderabad all modules are clearly solved and practice with guide.seo training in hyderabadAnd clearly getting knowledge of seo.

    ReplyDelete
  9. WONDERFUL ARTICLE, REALLY GOOD INFORMATION AND NICE EXPLANATION...KEEP IT UP.

    ReplyDelete
  10. Excellent post. I like your blog. Thanks for sharing.

    ppc training in chennai

    ReplyDelete
  11. Thank you so much..i have to really helpful for your sharing information..
    best informatica training institute

    ReplyDelete
  12. This was actually what i was looking for, and i am glad to came here! Thank you very much
    angelfire
    wikidot
    mywapblog
    page
    inube
    tumblr

    ReplyDelete
  13. Great post, This is very useful, Thanks for sharing and keep updating your post.
    Ladies Hostel in Kodambakkam

    ReplyDelete
  14. On this give maneuver: tandum-heart and soul collapsing ward, crystal clear adi inside period of time of
    brand new unimportant; for any shining, kobe Bryant, initially the emperor incarnate elect; period is the
    abbreviation, on playoffs multiple better running footwear…
    My Web : we like to honor numerous other world wide web web pages around the web,
    Penangkal Petir Mueven though they arent linked to us, Penangkal Petir by linking to them.

    ReplyDelete
  15. A pioneer Institute owned by industry professionals to impart vibrant, innovative and global education in the field of Hospitality to bridge the gap of 40 lakh job vacancies in the Hospitality sector. The Institute is contributing to the creation of knowledge and offer quality program to equip students with skills to face the global market concerted effort by dedicated faculties, providing best learning environment in fulfilling the ambition to become a Leading Institute in India.

    cha jaipur
    management college in jaipur
    management of hospitality administration jaipur
    cha management jaipur
    Best hotel college in jaipur
    Best management college in jaipur

    ReplyDelete
  16. Great articles,first of all Thanks for writing such lovely Post! Earlier I thought that posts are the only most important thing on any blog.... Android Training in Chennai
    Selenium Training in Chennai
    Hadoop Training in Chennai

    ReplyDelete
  17. The blog gave me idea about Page directive and the information about the attributes in page directive were very much useful. My sincere thanks for sharing this post
    Dot Net Training in Chennai

    ReplyDelete
  18. Thank you so much for sharing this worth able content with us. The concept taken here will be useful for my future programs and i will surely implement them in my study. Keep blogging article like this.
    dot net training in chennai

    ReplyDelete
  19. Thank you for sharing.If anyone want to become an Dotnet certified professional reach TIS Academy, which offers best Dot Net Training in Chennai with years of experienced professionals. For more details about courses..
    Hadoop Training in Chennai

    ReplyDelete
  20. The blog gave me idea about the functional Programming and the features of functional programming are explained in an understandable manner Thanks for sharing this valuable post
    dotnet training in chennai

    ReplyDelete
  21. really you have posted an informative blog. it will be really helpful to many peoples. thank you for sharing this blog. before i read this blog i didn't have any knowledge about this but now i got some knowledge.
    dot net training in chennai

    ReplyDelete
  22. Interesting and attractive article, very useful to me.. thanks for sharing your information..


    Dot Net Training in chennai | Dot Net Training institute in chennai

    ReplyDelete
  23. This comment has been removed by the author.

    ReplyDelete
  24. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
    dot-net training in chennai

    ReplyDelete
  25. This comment has been removed by the author.

    ReplyDelete
  26. I enjoy what you guys are usually up too. This sort of clever work and coverage! Keep up the wonderful works guys I’ve added you guys to my blog roll.
    diploma in fire and safety course in chennai

    ReplyDelete
  27. Thank you for sharing the information. This is very valuable information. We are one of the leading software development company at chennai. Pls call +91 - 44 - 4294 9615 to schedule demo or send email to info@sphinaxinfosystems.com
    Our site:Sphinax info systems

    ReplyDelete
  28. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition. Dotnet developer
    Authorized Dot Net training in chennai

    ReplyDelete
  29. Thanks The information which you provided is very much useful and easy to learn as well... keep rocking and updating... looking further..
    Austere Technologies |Internet Of Things

    ReplyDelete
  30. Great article, really very helpful content you made. Thank you, keep sharing.

    Application Quality Managment Services | Austere Technology Solutions

    ReplyDelete
  31. Really great blog, it's very helpful and has great knowledgeable information.

    Best Software Security Services | Austere Technology Solutions

    ReplyDelete
  32. Nice Blog, Thanks for sharing this valuable information. Keep sharing like this.

    Dot Net Training in Chennai

    ReplyDelete
  33. Great post! Wonderful information, Thanks for sharing with us.

    Selenium Training in Chennai

    ReplyDelete
  34. Thanks for sharing this wonderful blog. Helpful article ! Kindly visit us @ Chocolate gift box

    ReplyDelete
  35. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
    RPA Training in Chennai
    Selenium Training in Chennai
    RPA course
    Robotic Process Automation Certification
    Selenium testing training in chennai
    Selenium course

    ReplyDelete
  36. This comment has been removed by the author.

    ReplyDelete
  37. My spouse and I love your blog and find almost all of your post’s to be just what I’m looking for.
    safety course in chennai

    ReplyDelete
  38. Looking for best TNPSC study materials to prepare for the examination? Make use of our samacheer kalvi books and other study guide to learn from experts. TNPSC One Time Registration

    ReplyDelete
  39. It was really a nice experience to be on your blog. Get Osha online safety training course from Safetraining.com. For more visit here osha training online

    ReplyDelete
  40. Great Post. Thanks for sharing this valuable information with us..

    Website Development Company in Delhi

    ReplyDelete
  41. As yet utilizing this customary time, Trinidad has the biggest fair, with day by day occasions for about a month paving the way to Shrove Tuesday. Jamie Foxx

    ReplyDelete
  42. Proper construction courses are available online who provides the WHMIS training courses to employees for safely working at the construction site. You can opt for professional Traffic Control Person Course for more information.

    ReplyDelete
  43. Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it, because you have explained the concepts very well. It was crystal clear, keep sharing.. i Want to share Some data regarding the websphere training videos with free bundle videos is provided.

    ReplyDelete
  44. Great Article. Thank you for sharing! Really an awesome post for every one.

    IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

    JavaScript Training in Chennai

    JavaScript Training in Chennai


    ReplyDelete
  45. This comment has been removed by the author.

    ReplyDelete

  46. Wow. That is so elegant and logical and clearly explained. Brilliantly goes through what could be a complex process and makes it obvious.I want to refer about the best websphere training videos and websphere admin training

    ReplyDelete
  47. So do yourself an enormous kindness and ensure the point hasn't been secured at this point before writing anything. Wikipedia page creation services

    ReplyDelete
  48. This blog clearly illustrates the ASP.NET @ Page directive with nice explanation. Thanks for sharing the blog and keep updating regularly! Visit: website development company in Chennai | seo company in Chennai

    ReplyDelete
  49. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    machine learning course training in guduvanchery

    ReplyDelete
  50. thank you my friend http://www.azarchat.net

    ReplyDelete
  51. Salesforce versatility include likewise has makes an effect in its convenience, with respect to any developing business Salesforce can meet the intricacy and volume taking care of assumption and necessity of the business.
    Salesforce training with job support in Pune

    ReplyDelete
  52. best logo design companies
    Hey buddies, such a marvelous blog you have made I’m surprised to read such informative stuf

    ReplyDelete