HTML control Raiders 02-3-7 01:30:17
We know that in ASP.NET, we have used two types of controls, and one is HTML control, and there is a web control. We are already familiar because it is ASP.NET, which generally describes the detailed application skills of these controls; and HTML controls, there are many articles about ASP.NET, only one sentence, Even if you add "Runat =" Server "based on the original HTML, many users have almost no HTML controls in the process of using ASP.NET, and more don't know the specific use of these controls and details. Features. In fact, although HTML controls are similar to HTML, in terms of HTML, in terms of function, HTML controls can have their own "event", so some HTML is completely impossible, using HTML controls can be easily implemented.
First, HTML control introduction
HTML controls have primary locations in ASP.NET program, because of its simple and HTML similarity, we can use HTML controls to replace Web controls. In ASP.NET, there are 20 html controls, and the interrelationships between them are as follows:
Second, the use of HTML controls
The use of HTML controls is simple, and it is important to use. HTML and ASP use, let us develop some are not too good habits, including code writing, and even completely detached object-oriented programming, now we use HTML controls, slowly returning to object-oriented programming Habits and ideas. There are more HTML controls, and we now choose a relatively common and practical control example introduction.
1, HTMLANCHOR control
In ASP, we build a link is such link text
<% @ Page language = "vb"%> <% @ Import namespace = "system.data"%> Sub BTNCLK (Sender As Object, E AS Eventargs) A1.INNNERTEXT = "Welcome" End Sub Script>
Form>
In the above code, the link has an event handling! This way, we can do some necessary processing after the link is clicked. One thing to note is: Here, not onclick is ONServerClick. Now let's look at a more complex example, in this example, click the link to display a picture, then click, you can hide the image, the code is as follows:
Void Page_Load (Object Sender, Eventargs E) {
IF (! ispostback) {
Showhidelink.innertext = image.visible? "Hide Picture": "Show Pictures";
}
}
Void Showhidead (Object Sender, Eventargs E) {
Image.visible = image.visible? false: True;
Showhidelink.innertext = image.visible? "Hide Picture": "Show Pictures";
}
script>
hEAD>