|
If you write on the designer (aspx, ascx):
<asp: TextBox id = aaa Text = "demo1"> </ asp: TextBox>
adfa
<input type = text id = bbb Value "demo2" />
<asp: TextBox id = ccc runat = server Text = "demo3"> </ asp: TextBox>
<input type = text id = ddd runat = server Value "demo4" />
123456
Note that this is interpreted as 4 controls by asp.net!
Written in code like this:
LiteralControl c1 = new LiteralControl (
"<asp: TextBox id = aaa Text =" demo1 "> </ asp: TextBox>\r\n" +
"adfa\r\n" +
"<input type = text id = bbb Value" demo2 "/>\r\n");
TextBox c2 = new TextBox ();
c2.ID = "ccc";
c2.Text = "Demo3";
HtmlInputText c3 = new HtmlInputText ();
c3.ID = "ddd";
c3.Value = "Demo4";
LiteralControl c4 = new LiteralControl ("123456");
From c1 and c4 you can see that there is no "client control". asp.net doesn't know dhtml or javascript (although vss will help you check the syntax and prompt some possible exceptions), it will always pack any non-server control code into a simplest server control, and then communicate with other servers The controls participate in the various processing cycles of the page together, and finally output html to the client.
c2 is a webControl. c3 is a htmlControl.
The basic objects of htmlControl are very similar to html. In this way, many codes in the html file can be directly transplanted, and "runat = server" can be easily converted into server controls. However, it can be seen from c1 and c3 that adding or not adding "runat = server" is completely different, rather than simply adding a parameter.
webControl has more rich functions, especially it maintains a lot of states and triggers events. For example, GridView can generate many interfaces by itself, and has complex processes such as data source processing, template processing, and paging. The entire webControl follows an interface habit that is unique to WinForm controls, such as the Text property, and is not the same as the HtmlControl habit of following the definition of a dhtml object.
Page and userControl are controls that can edit the interface on the designer and dynamically resolve at runtime. You can manually modify aspx or ascx and then execute it directly. At the same time they are automatically pre-compiled for maximum efficiency. Although "slower" than webControl, it is also very flexible. You can use the RAD development form to design the interface by dragging with the mouse. This is not a custom control and its exquisite interface development technology. |
|