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
- <!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.