Default child controls in any web page in the asp.net

Rajkatie
Posted by in ASP.NET category on for Intermediate level | Points: 250 | Views : 8240 red flag
Rating: 4.5 out of 5  
 4 vote(s)

Hope this article helps you to increase your .net internal knowledge.

Introduction

In this article, I am going to demonstrate you default server child control that a single web page contains.


Objective

To learn the controls that a single web page contains by default.

Using the code

As developer we have worked lot of times with web page containing simple control like textbox to complex control like grid control, etc; but ever wonder how many default child controls does a single web page contains without putting any in-built control in web page.

In this article, we will find out control name and its type. Let us get started.

Step 1: create new website and write following line in Page_Load event


Step 2: run the website, it gives following output


Step 3: Now modified the above code for finding out child controls type.

 

Step 4: Now, run the web site and browser will show below output .

 

 

Step 5:  Its shows there are 3 literal controls, one htmlhead control and last one is htmlform control. Two child controls like form and head are obvious means we can find them out easily but what about other 3 literal controls.

Step 6: Blow are all five child control names

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

2. <head><title></title></head>

3.<body>


 

4. <form name="form1" method="post" action="Default.aspx" id="form1"><div>

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="" />

</div>  </form>

5. </body></html>

Mostly above are the default five child controls present in single web page but in case of  removing  runat attribute from <head> tag, the count will be 4.

 

Page copy protected against web site content infringement by Copyscape

About the Author

Rajkatie
Full Name: Rajesh Patel
Member Level: Gold
Member Status: Member,MVP
Member Since: 2/14/2012 4:06:42 AM
Country: India
Rajesh Patel R.P.A Developer | Developer Trainer | Clean Code Evangelist
http://www.dotnetfunda.com/profile/rajkatie.aspx
I am Rajesh Patel ,Microsoft certified trainer since 2013, developer, mentor and senior software engineer. He has trained and mentored many developers of fortune IT organizations (Allscripts, Cognizant, L&T info-tech, Automation anywhere, Odysseus, PmcRetail, Advance-india, Webmyne, to name but a few). He is also involved in organizing other, free educational events in the Vadodara, Anand, Ahmedabad and Nadiad city. He also enjoys running Seminars,workshops and hands on labs with anyone willing to learn.

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)