Is it correect to say that the div element is a control


T

Tony Johansson

Hello!

Here I have a HTML document.
I just wonder if it's correct to say that the div element in this document
is also a control.
My definition is that the div is of course an element but not a control.
I would say that a control is only those that has a visual appearance on the
form like table,TextBox, Label and so on.
Is this a correct interpretation ?

%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

<!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">
<head runat="server">
<title>My example</title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 154px;
}
</style>
</head>

<body>
<form id="form1" runat="server">
<table class="style1">
<tr>
<td class="style2"> Chose a color </td>
<td>
<input runat="server" id="btnRed" type="button" value="Red"
style="background-color: #FF0000; Width: 80px"
onserverclick="btnRed_ServerClick" /> &nbsp;
<input runat="server" id="btnGreen" type="button"
value="Green" style="background-color: #00FF00; width: 80px;"
onserverclick="btnGreen_ServerClick" /> &nbsp;
<input runat="server" id="btnBlue" type="button"
value="Blue" style="width: 80px; background-color: #0000FF;"
onserverclick="btnBlue_ServerClick" />
</td>
</tr>
<tr>
<td class="style2"> &nbsp; </td>
<td>
<div runat="server" id="DIV1"></div>
</td>
</tr>
</table>
</form>
</body>
</html>

//tony
 
Ad

Advertisements

A

Arne Vajhøj

Hello!

Here I have a HTML document.
I just wonder if it's correct to say that the div element in this document
is also a control.
My definition is that the div is of course an element but not a control.
I would say that a control is only those that has a visual appearance on the
form like table,TextBox, Label and so on.
Is this a correct interpretation ?

A <div runat="server"> becomes a:
System.Web.UI.HtmlControls.HtmlGenericControl
so it is a control, but because it is a HtmlGenericControl and
not a HtmlDiv (that does not exist), then it is not very useful.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top