Home > Articles > Programming > ASP .NET

  • Print
  • + Share This
This chapter is from the book

Programming HTML Controls

In this section we'll take a look, one by one, at the HTML controls provided by ASP.NET and show you examples of some of the more interesting ones.

HtmlAnchor

Member of System.Web.UI.HtmlControls

Assembly: System.Web.Dll

The HtmlAnchor control encapsulates the <a> tag with a server-side control model. You shouldn't use this for every link, but it makes it easy to dynamically generate links as needed.

Properties

 

 

Attributes

ClientID

Controls

Disabled

EnableViewState

Href

ID

InnerHtml

InnerText

Name

NamingContainer

Page

Parent

Site

Style

TagName

Target

TemplateSourceDirectory

Title

UniqueID

Visible

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerClick


Listings 3.10 and 3.11 show a page that alters a link based on whether the page containing the link is accessed using HTTPS. This is a frequent requirement when building secure e-commerce Web sites.

Listing 3.10 The HTML for a Dynamically Generated Anchor Using the HtmlAnchor Control

<%@ Page Language="vb" AutoEventWireup="false"
 Codebehind="Anchor.aspx.vb" Inherits="HtmlControls.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <title>Dynamically Generated Anchor</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <a id="AnchorTag" runat="server">Test Anchor</a>
    </form>
  </body>
</HTML>

Listing 3.11 The Code for a Dynamically Generated Anchor Using the HtmlAnchor Control

Public Class WebForm1
  Inherits System.Web.UI.Page
  Protected WithEvents AnchorTag As System.Web.UI.HtmlControls.HtmlAnchor
  
  Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
    If Page.Request.IsSecureConnection Then
      AnchorTag.HRef = "https://http://www.deeptraining.com"
      AnchorTag.InnerText = "Secure Link"
    Else
      AnchorTag.HRef = "http://www.deeptraining.com"
      AnchorTag.InnerText = "Unsecure Link"
    End If
  End Sub
End Class

The ServerClick event enables you to optionally process the anchor on the server side instead of the client side. This adds an extra round trip to the action but allows you to treat text just like buttons that invoke server-side actions. The InnerText or InnerHtml properties enable you to alter the content between the <a> and </a> tags, as shown in Listing 3.11. The Title property corresponds to the alt text or ToolTip that pops up for an anchor.

HtmlButton

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlButton class provides a server-side encapsulation of the HTML 4.0 <button> tag. It works only in Internet Explorer 4.0 and later. If you want to use a button that works in a wider variety of browsers, take a look at HtmlInputButton later in this section.

Properties

 

 

Attributes

CausesValidation

ClientID

Controls

Disabled

EnableViewState

ID

InnerHtml

InnerText

NamingContainer

Page

Parent

Site

Style

TagName

TemplateSourceDirectory

UniqueID

Visible

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerClick


This control is primarily used to kick off some server-side processing. This is done through the ServerClick event. Listings 3.12 and 3.13 show a page with an HtmlButton control that fires off some script in the page to write some text to the page.

Listing 3.12 The HTML for Button.aspx

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Button.aspx.vb" 
Inherits="HtmlControls.Button"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <title>HtmlButton Class</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <button id="btnClick" title="" type="button" runat="server">
       Click Me</button>
    </form>
  </body>
</HTML>

Listing 3.13 The Code for Button.aspx

Public Class Button
  Inherits System.Web.UI.Page
  Protected WithEvents btnClick As System.Web.UI.HtmlControls.HtmlButton

  Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    btnClick.InnerText = "Click Me!"
  End Sub

  Private Sub btnClick_ServerClick(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnClick.ServerClick
    Response.Write("You clicked me!")
  End Sub
End Class

HtmlForm

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlForm class allows you to change the properties of a form on the server side. These properties include the target you are posting to as well as the method used to send the data to the server.

Properties

 

 

Attributes

ClientID

Controls

Disabled

EnableViewState

EncType

ID

InnerHtml

InnerText

Method

Name

NamingContainer

Page

Parent

Site

Style

TagName

Target

TemplateSourceDirectory

UniqueID

Visible

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

PreRender

Unload


The EncType property controls the encoding of the form. Valid encoding types include "multipart/form-data," "text/plain," and "image/jpeg." Listings 3.14 and 3.15 alter the Method property to determine how the form data is posted to the server.

Listing 3.14 The HTML for Form.aspx

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Form.aspx.vb" 
Inherits="HtmlControls.Form"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <title>Dynamically Altering Form Method</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <asp:RadioButtonList id="RadioButtonList1" runat="server" 
        AutoPostBack="True">
        <asp:ListItem Selected="True" Value="Post">Post</asp:ListItem>
        <asp:ListItem Value="Get">Get</asp:ListItem>
      </asp:RadioButtonList>
    </form>
  </body>
</HTML>

Listing 3.15 The Code for Form.aspx

Public Class Form
  Inherits System.Web.UI.Page
  Protected WithEvents RadioButtonList1 As _
    System.Web.UI.WebControls.RadioButtonList
  Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm

  Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    Response.Write("Form Method used to Send: " + Form1.Method)
  End Sub

  Private Sub RadioButtonList1_SelectedIndexChanged( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles RadioButtonList1.SelectedIndexChanged
    Form1.Method = RadioButtonList1.SelectedItem.Value
  End Sub
End Class

Note

In the code example in Listing 3.15, you will have to press the radio button twice to see the results. This is because the procedure that outputs the form method runs prior to the RadioButtonList1_SelectedIndexChanged event that actually alters the way the form works.

HtmlImage

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlImage class encapsulates the HTML <img> tag. This can be useful for dynamically pointing to multiple images on your site. Note that this does not enable you to send the actual image data. You can alter only where the browser retrieves the image data from.

Properties

 

 

Align

Alt

Attributes

Border

ClientID

Controls

Disabled

EnableViewState

Height

ID

NamingContainer

Page

Parent

Site

Src

Style

TagName

TemplateSourceDirectory

UniqueID

Visible

Width

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

PreRender

Unload


Listings 3.16 and 3.17 use the image-specific properties of this server control to allow you to alter how an image is displayed on the page.

Listing 3.16 The HTML for image.aspx

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Image.aspx.vb" 
Inherits="HtmlControls.Image"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <title>Image Properties</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <table>
        <tr>
          <td>
            <img src="deeplogo2.jpg" runat="server" id="IMG1">
          </td>
        </tr>
        <tr>
          <td>
            Alt:&nbsp; <input type="text" id="txtAlt" 
            runat="server" value="Deep Logo">
            <br>
            <input type="checkbox" id="chkBorder" runat="server">
            Border &nbsp;&nbsp;&nbsp; 
            <input type="checkbox" id="chkVisible" runat="server" 
            Checked="True">Visible
            <br>
            Alignment:&nbsp; 
            <select id="ddAlignment" runat="server">
              <option Value="left">
                Left</option>
              <option Value="center">
                Center</option>
              <option Value="right">
                Right</option>
              <option Value="top">
                Top</option>
              <option Value="middle">
                Middle</option>
              <option Value="bottom">
                Bottom</option>
            </select>
            <br>
            Size:&nbsp; 
            <input type="text" id="txtWidth" runat="server" 
              Width="51px" Height="24px">
            &nbsp;x 
            <input type="text" id="txtHeight" runat="server" 
              Width="51px" Height="24px">
            <br>
            Src: 
            <input type="text" id="txtSrc" runat="server" 
              value="deeplogo2.jpg"> </P>
            <P>
              &nbsp;
            </P>
            <P>
              <input type="submit" id="btnApply" 
                runat="server" Value="Apply Settings">
            </P>
          </td>
        </tr>
      </table>
    </form>
  </body>
</HTML>

Listing 3.17 The Code for image.aspx

Public Class Image
  Inherits System.Web.UI.Page
  Protected WithEvents txtAlt As System.Web.UI.HtmlControls.HtmlInputText
  Protected WithEvents chkBorder As _
   System.Web.UI.HtmlControls.HtmlInputCheckBox
  Protected WithEvents ddAlignment As System.Web.UI.HtmlControls.HtmlSelect
  Protected WithEvents txtWidth As System.Web.UI.HtmlControls.HtmlInputText
  Protected WithEvents txtSrc As System.Web.UI.HtmlControls.HtmlInputText
  Protected WithEvents chkVisible As _
   System.Web.UI.HtmlControls.HtmlInputCheckBox
  Protected WithEvents btnApply As _
   System.Web.UI.HtmlControls.HtmlInputButton
  Protected WithEvents IMG1 As System.Web.UI.HtmlControls.HtmlImage
  Protected WithEvents txtHeight As System.Web.UI.HtmlControls.HtmlInputText

  Private Sub Button1_ServerClick(ByVal sender As System.Object, _
     ByVal e As System.EventArgs) Handles btnApply.ServerClick
    ' Set the alt text
    IMG1.Alt = txtAlt.Value
    ' If the border is checked set a border width
    If chkBorder.Checked Then
      IMG1.Border = 5
    Else
      IMG1.Border = 0
    End If
    ' Set the image alignment
    IMG1.Align = ddAlignment.Items(ddAlignment.SelectedIndex).Value
    ' If a width is entered then set it
    If txtWidth.Value <> "" Then
      IMG1.Width = txtWidth.Value
    End If
    ' If a height is entered then set it
    If txtHeight.Value <> "" Then
      IMG1.Height = txtHeight.Value
    End If
    ' Set the image to show
    IMG1.Src = txtSrc.Value
    ' Set whether it is visible
    IMG1.Visible = chkVisible.Checked
  End Sub
End Class

HtmlInputButton

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlInputButton class wraps up several HTML tags, including <input type=button> <input type=reset> and <input type=submit>. This class is supported in all browsers (unlike the HtmlButton class).

Properties

 

 

Attributes

CausesValidation

ClientID

Controls

Disabled

EnableViewState

ID

Name

NamingContainer

Page

Parent

Site

Style

TagName

TemplateSourceDirectory

Type

Visible

UniqueID

Value

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate
ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerClick


Listings 3.18 and 3.19 show the difference in behavior between the type=submit and type=reset buttons.

Listing 3.18 The HTML for inputbutton.aspx

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="InputButton.aspx.vb" 
Inherits="HtmlControls.InputButton"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <title>HtmlInputButton Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
      <input type="submit" id="btnSubmit" runat="server" value="Submit">
      <input type="reset" id="btnReset" runat="server" value="Reset">
    </form>
  </body>
</HTML>

Listing 3.19 The Code for inputbutton.aspx

Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls

Public Class InputButton
  Inherits System.Web.UI.Page
  Protected WithEvents btnSubmit As HtmlInputButton
  Protected WithEvents TextBox1 As TextBox
  Protected WithEvents btnReset As HtmlInputButton

  Private Sub Page_Load(ByVal sender As System.Object, _
     ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
  End Sub

  Private Sub btnSubmit_ServerClick(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnSubmit.ServerClick
    Response.Write("You clicked submit.")
  End Sub

  Private Sub btnReset_ServerClick(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnReset.ServerClick
    Response.Write("You clicked reset.")
  End Sub
End Class

HtmlInputCheckBox

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

HtmlInputCheckBox encapsulates the <input type=checkbox> tag. The Checked property indicates whether the item was checked. Listing 3.17 uses the HtmlInputCheckbox to indicate the visibility of the image. The ServerChange event can be used to catch the change in value of the control on the server.

Properties

 

 

Attributes

Checked

ClientID

Controls

Disabled

EnableViewState

ID

Name

NamingContainer

Page

Parent

Site

Style

TagName

TemplateSourceDirectory

Type

Visible

UniqueID

Value

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerChange


HtmlInputFile

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

Provides a way for you to upload files to the server. This control encapsulates the <input type=file> tag on the client and also provides a way to extract the file information from the posted data. For this control to work, the EncType of the form must be set to multipart/ form-data.

Properties

 

 

Accept

Attributes

ClientID

Controls

Disabled

EnableViewState

ID

MaxLength

Name

NamingContainer

Page

Parent

PostedFile

Site

Size

Style

TagName

TemplateSourceDirectory

Type

Visible

UniqueID

Value

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

PreRender

Unload


Listings 3.20 and 3.21 show a page that collects the name of a file from the user and then uploads it to the server. On the server side we grab the content of the posted file and place it into a text area. The Accept property is used to indicate that only files with a MIME type of text are allowed to be uploaded.

Listing 3.20 The HTML for inputfile.aspx

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="InputFile.aspx.vb" 
Inherits="HtmlControls.InputFile"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <title>Input File Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server" 
      enctype="multipart/form-data">
      <input type="file" id="FilePost" runat="server">
      <input type="submit" id="btnSubmit" runat="server" 
        value="Send File">
      <br>
      <textarea id="txtOutput" runat="server" 
        style="WIDTH: 733px; HEIGHT: 630px" rows="39" cols="89">
      </textarea>
    </form>
  </body>
</HTML>

Listing 3.21 The Code for inputfile.aspx

Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls

Public Class InputFile
  Inherits System.Web.UI.Page
  Protected WithEvents FilePost As HtmlInputFile
  Protected WithEvents btnSubmit As HtmlInputButton
  Protected WithEvents txtOutput As HtmlTextArea

  Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    FilePost.Accept = "text/*"
  End Sub

  Private Sub btnSubmit_ServerClick(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnSubmit.ServerClick
    Dim pf As HttpPostedFile
    Dim tr As New System.IO.StreamReader(FilePost.PostedFile.InputStream)

    txtOutput.Value = tr.ReadToEnd()
  End Sub
End Class

HtmlInputHidden

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlInputHidden class encapsulates the <input type=hidden> tag. This can be used to put hidden text into the body of a form.

Note

In Web programming, it was common to use a <hidden> control to retain state information from one page reload to the next. It's not as common to use the HtmlInputHidden control for this purpose in ASP.NET because you have so many other options for state management. For example, you might want to use the State bag provided by the ViewState property of the Page object instead.

Properties

 

 

Attributes

ClientID

Controls

Disabled

EnableViewState

ID

Name

NamingContainer

Page

Parent

Site

Style

TagName

TemplateSourceDirectory

Type

UniqueID

Value

Visible

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerChange


Listing 3.22 shows an example of using an HtmlInputHidden object to submit additional information along with the form. In this example, you want the form to send the date and time the user accessed the page along with the data the user entered. The hidden control stores and submits this additional information.

Listing 3.22 Using an HtmlInputHidden Control to Submit Additional Information in a Form

<%@ Page language='VB' debug='true' trace='false' %>
<script runat='server'>
 Sub Page_Load(Sender As Object, e As EventArgs)
  If Not(Page.IsPostBack) Then
   CreationDate.Value = Now
  End If
 End Sub
 
 Sub btnSubmit_Click(Sender As Object, e As EventArgs)
  spnResult.InnerHtml = "This account was created on " & CreationDate.Value
 End Sub
</script>
<html>
<head>
<title>ASP.NET Page</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form runat='server'>
 Your Name: 
 <input type="text" id="txtValue" value="Jeffrey" runat='server'>
 <input type='submit' id="btnSubmit" OnServerClick='btnSubmit_Click' 
   value="Create" runat='server'> 
 <br>
 Your Address: 
 <input type="text" name="txtAddress" value="4905 Brown Valley Lane">
 <input type="hidden" id="CreationDate" runat='server'>
</form>
<span id='spnResult' runat='server'></span>
</body>
</html>

In this code, the current date and time is stored in the hidden control when the page is loaded. When the form is submitted to the server, the value of the date stored in the hidden field is sent to the server where it can be utilized in code. In this case, the date is simply displayed, but you could incorporate it into database insertions and so forth.

There are several alternate ways you can hide information on the page the way a hidden control does. For example, most server controls have a Visible property. Setting this property to false hides the control, enabling you to assign data to the control without the data displaying on the page.

Note that "hiding" information by assigning it to a hidden control doesn't actually prevent the user from accessing the information; if you view the page's source in the browser, it's easy to see the value of the hidden control. It's even conceivable that a user could change the value of the hidden control. For this reason, be careful when using hidden controls to store certain types of sensitive information in your Web applications.

HtmlInputImage

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlInputImage class encapsulates the <input type=image> tag. Use this tag when you want your button to look like something other than a button. You supply the image. The ServerClick method fires an action on the server.

Properties

 

 

Align

Alt

Attributes

Border

CausesValidation

ClientID

Controls

Disabled

EnableViewState

ID

Name

NamingContainer

Page

Parent

Site

Src

Style

TagName

TemplateSourceDirectory

Type

UniqueID

Value

Visible

 

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerClick


HtmlInputRadioButton

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlInputRadioButton class encapsulates the <input type=radio> tag. You group radio buttons together to form a group by assigning the same Name property to each button. The user may select only one member of the group.

Properties

 

 

Attributes

ClientID

Controls

Disabled

EnableViewState

ID

Name

NamingContainer

Page

Parent

Site

Style

TagName

TemplateSourceDirectory

Type

UniqueID

Value

Visible

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

PreRender

Unload


HtmlInputText

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlInputText class encapsulates the <input type=text> tag. See Listings 3.16 and 3.17 for an example of this class in use.

Properties

 

 

Attributes

ClientID

Controls

Disabled

EnableViewState

ID

MaxLength

Name

NamingContainer

Page

Parent

Site

Size

Style

TagName

TemplateSourceDirectory

Type

UniqueID

Value

Visible

 

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerChange


HtmlSelect

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlSelect class is the ASP.NET HTML control abstraction of the HTML SELECT element. You can set the Multiple property to true to enable the user to select multiple items in the list. The Items collection contains the items. Use <controlname>.Items(<controlname>.SelectedIndex).Value to get the selected items value. See Listing 3.9 for the HtmlSelect class in action.

Properties

 

 

Attributes

ClientID

Controls

DataMember

DataSource

DataTextField

DataValueField

Disabled

EnableViewState

ID

InnerHtml

InnerText

Items

Multiple

NamingContainer

Page

Parent

SelectedIndex

Site

Size

Style

TagName

TemplateSourceDirectory

UniqueID

Value

Visible

 

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerChange


HtmlTable

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlTable class encapsulates the <table> tag. The Rows property returns a collection of all the <TR> tags in the table.

Properties

 

 

Align

Attributes

BgColor

Border

BorderColor

CellPadding

CellSpacing

ClientID

Controls

Disabled

EnableViewState

Height

ID

InnerHtml

InnerText

NamingContainer

Page

Parent

Rows

Site

Style

TagName

TemplateSourceDirectory

UniqueID

Visible

Width

 

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

PreRender

Unload


HtmlTableCell

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlTableCell class encapsulates the individual cells in an HtmlTableRow. The ColSpan and RowSpan properties can be used to span a number of columns or rows, respectively. The NoWrap property can be used to indicate that a cell shouldn't wrap. The Align and Valign properties can be used to control alignment.

Properties

 

 

Align

Attributes

BgColor

BorderColor

ClientID

ColSpan

Controls

Disabled

EnableViewState

Height

ID

InnerHtml

InnerText

NamingContainer

NoWrap

Page

Parent

RowSpan

Site

Style

TagName

TemplateSourceDirectory

UniqueID

Valign

Visible

Width

 

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

PreRender

Unload


HtmlTableCellCollection

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

This class represents a collection of all HtmlTableCells within an HtmlTable control.

Properties

 

 

Count

IsReadOnly

IsSynchronized

Item

SyncRoot

 

Methods

 

 

Add

Clear

CopyTo

Equal

GetEnumerator

GetHashCode

GetType

Insert

Remove

RemoveAt

ToString

 


HtmlTableRow

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlTableRow class encapsulates a <tr> tag.

Properties

 

 

Align

Attributes

BgColor

BorderColor

Cells

ClientID

Controls

Disabled

EnableViewSTate

Height

ID

InnerHtml

InnerText

NamingContainer

Page

Parent

Site

Style

TagName

TemplateSourceDirectory

UniqueID

Valign

Visible

 

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

PreRender

Unload


HtmlTableRowCollection

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

A collection of the table rows inside the HtmlTable control.

Properties

 

 

Count

IsReadOnly

IsSynchronized

Item

SyncRoot

 

Methods

 

 

Add

Clear

CopyTo

Equal

GetEnumerator

GetHashCode

GetType

Insert

Remove

RemoveAt

ToString

 


HtmlTextArea

Member of System.Web.UI.HtmlControls

Assembly: System.Web.dll

The HtmlTextArea class encapsulates the <textarea> tag. The Rows and Cols properties can be used to dynamically size the control. See Listing 3.20 for an example of the HtmlTextArea control in action.

Properties

 

 

Attributes

ClientID

Cols

Controls

Disabled

EnableViewState

ID

InnerHtml

InnerText

Name

NamingContainer

Page

Parent

Rows

Site

Style

TagName

TemplateSourceDirectory

UniqueID

Value

Visible

Methods

 

 

DataBind

Dispose

Equals

FindControl

GetHashCode

GetType

HasControls

RenderControl

ResolveUrl

SetRenderMethodDelegate

ToString

 

Events

 

 

DataBinding

Disposed

Init

Load

Unload

PreRender

ServerChange


  • + Share This
  • 🔖 Save To Your Account