Read Build Your Own ASP.NET 3.5 Website Using C# & VB Online
Authors: Cristian Darie,Zak Ruvalcaba,Wyatt Barnett
Tags: #C♯ (Computer program language), #Active server pages, #Programming Languages, #C#, #Web Page Design, #Computers, #Web site development, #internet programming, #General, #C? (Computer program language), #Internet, #Visual BASIC, #Microsoft Visual BASIC, #Application Development, #Microsoft .NET Framework
Controls
a collection of all the controls contained within the web
control (its child controls)
CssClass
indicates the style class within the current CSS style sheet
that should be applied to the web control
Enabled
determines whether the web control is active and able to
receive user input
EnableTheming
determines whether the control uses themes
Font
a FontInfo object representing the control’s current font;
properties of FontInfo include Bold, Italic, Name, Names,
Overline, Size, Strikeout, and Underline
ForeColor
the control’s current foreground color
Height
the current height of the control
SkinID
the ID of the skin to be used by the control
Style
allows the manipulation of the CSS style elements through
the returned CssStyleCollection object
TabIndex
defines the order in which controls on the page are selected when the user presses
Tab
; the lowest value is selected first
Tooltip
the text that appears in a popup when the cursor is
hovered over the control
Visible
determines whether the control appears on-screen in the
user’s browser
Width
the current width of the control
Methods
ApplyStyle
copies an element of a Style object to a control
Licensed to [email protected]
Appendix A: Web Control Reference
659
MergeStyle
copies an element of a Style object to a control but does
not overwrite existing styles
DataBind
binds the web control to its data source
As well as the properties and methods described here, web controls offer additional
properties and methods specific to each control. These are listed in the following
sections.
Standard Web Controls
AdRotator
Properties
AdvertisementFile
specifies the path to the XML file that contains the list of
banner advertisements
KeywordFilter
returns only advertisements that match a specific filter
when the property is set
Target
displays the page in this window or frame; possible values
are _child, _self, _parent, and _blank
Events
AdCreated
raised after an ad is retrieved from the advertisement file,
but before the ad is rendered
BulletedList
Properties
BulletImageUrl
specifies the URL of the image used to display the bullets
BulletStyle
identifies the style of the bulleted list; can take one of the
BulletStyle enumeration values: Numbered (1, 2, 3, ...),
LowerAlpha (a, b, c, ...), UpperAlpha (A, B, C, ...), LowerRoman (i, ii, iii, ...), UpperRoman (I, II, III, ...), Circle, CustomImage, Disc, and Square Licensed to [email protected]
660
Build Your Own ASP.NET 3.5 Web Site Using C# & VB
DisplayMode
determines the display mode, which can be Text (the
default), or HyperLink (if you want the list to be formed
of links)
FirstBulletNumber
specifies the value of the first bullet
SelectedIndex
the index of the selected item
SelectedItem
specifies the currently selected item as a ListItem object
SelectedValue
the Value of the selected ListItem object
Target
specifies the target window or frame in which new content
should be displayed when a link is clicked; possible values are _blank, _parent, _search, _self, and _top
Text
the text of the BulletedList control
Events
Click
raised when the Button is clicked and the form is submitted to the server for processing
Button
Properties
CommandName
passes a value to the Command event when the Button is
clicked
CommandArgument
passes a value to the Command event when the Button is
clicked
CausesValidation
allows interaction with client-side validation controls;
when False, validation does not occur
Text
specifies the text displayed by the Button
Visible
controls the visibility of the Button
Licensed to [email protected]
Appendix A: Web Control Reference
661
Events
Click
raised when the Button is clicked and the form is submitted to the server for processing
Command
raised when the Button is clicked and the form is submitted to the server for processing; passes the values of the CommandName and CommandArgument properties
Calendar
Properties
CellPadding
specifies the number of pixels between a cell and its border
CellSpacing
specifies the number of pixels between cells
DayHeaderStyle
specifies the style of the weekdays listed at the top of the
calendar
DayNameFormat
sets the format of day names; possible values are
FirstLetter, FirstTwoLetters, Full, and Short
DayStyle
specifies the style applied to each day in the calendar
FirstDayOfWeek
specifies which day of the week is displayed in the first
column
NextMonthText
if ShowNextPrevMonth is True, specifies the text for the
next month hyperlink
NextPrevFormat
specifies the format for the next and previous hyperlinks
NextPrevStyle
specifies the style to use for next and previous month
links
OtherMonthDayStyle
specifies the style to use to display days of adjacent
months within the current month’s calendar
Licensed to [email protected]
662
Build Your Own ASP.NET 3.5 Web Site Using C# & VB
PrevMonthText
if ShowNextPrevMonth is True, specifies the text for the
previous month hyperlink
SelectedDate
contains a date-and-time value that specifies a highlighted
day
SelectedDates
contains a collection of date-and-time values that specify
the highlighted days
SelectedDayStyle
specifies the style to use for the currently selected day
SelectionMode
determines whether or not days, weeks, or months can
be selected; possible values are Day, DayWeek, DayWeekMonth, and None
SelectMonthText
contains the HTML text displayed in the month selector
column; default value is >>, which is rendered as
>>
SelectorStyle
specifies the style to be applied to the link for selecting
week and month
SelectWeekText
contains HTML text displayed for selecting weeks when
SelectionMode has the value DayWeek or DayWeekMonth
ShowDayHeader
if True, displays the names of the days of the week
ShowGridLines
if True, renders the calendar with a border around each
day’s cell
ShowNextPrevMonth
if True, displays links to the next and previous months
ShowTitle
if True, displays the calendar’s title
TitleFormat
determines how the month name appears in the title bar;
possible values are Month and MonthYear
TitleStyle
specifies the style to use for text within the title bar
TodayDayStyle
specifies the style to use for the current day
Licensed to [email protected]
Appendix A: Web Control Reference
663
TodaysDate
specifies a DateTime value that sets the calendar’s current
date
VisibleDate
specifies a DateTime value that sets the month to display
WeekendDayStyle
specifies the style to use for weekend days
Events
DayRender
raised before each day cell is rendered on the calendar
SelectionChanged
raised when a new day, month, or week is selected
VisibleMonthChanged
raised by clicking the next or previous month links
CheckBox
Properties
AutoPostBack
when True, automatically posts the form containing the
CheckBox whenever it’s checked or unchecked
Checked
shows the CheckBox as checked if set to True
Text
specifies the text displayed next to the CheckBox
TextAlign
determines how the text associated with the CheckBox is
aligned; possible values are Left and Right
Events
CheckedChanged
raised when the CheckBox is checked or unchecked
CheckBoxList
Properties
AutoPostBack
if True, automatically posts the form containing the
CheckBoxList whenever a CheckBox is checked or unchecked
Licensed to [email protected]
664
Build Your Own ASP.NET 3.5 Web Site Using C# & VB
CellPadding
sets the number of pixels between the border and a particular CheckBox
CellSpacing
sets the number of pixels between individual CheckBoxes
within the CheckBoxList
DataMember
represents the particular table within the data source
DataSource
represents the actual data source to use when binding to
a CheckBoxList
DataTextField
represents the field within the data source to use with the
CheckBoxList text label
DataTextFormatString
a format string that determines how the data is displayed
DataValueField
represents the field within the data source to use with the
CheckBoxList’s value
Items
the collection of items within the CheckBoxList
RepeatColumns
determines the number of columns to use when displaying
the CheckBoxList
RepeatDirection
indicates the direction in which the CheckBoxes should
repeat; possible values are Horizontal and Vertical
RepeatLayout
determines how the check boxes are formatted; possible
values are Table and Flow; default is Table
SelectedIndex
represents the index selected within the CheckBoxList
SelectedItem
represents the item selected within the CheckBoxList
Events
SelectedIndexChanged
raised when a CheckBox within the CheckBoxList is selected
Licensed to [email protected]
Appendix A: Web Control Reference
665
DropDownList
Properties
AutoPostBack
automatically posts the form containing the DropDownList
whenever the selection in the list is changed
DataMember
represents the particular table within the data source
DataSource
represents the actual data source to use when binding to
a DropDownList
DataTextField
represents the field within the data source to use with the
DropDownList’s text label
DataTextFormatString
specifies a format string that determines how the
DropDownList is displayed
DataValueField
represents the field within the data source to use with the
DropDownList’s value
Items
the collection of items within the DropDownList
SelectedIndex
represents the index selected within the DropDownList
SelectedItem
represents the item selected within the DropDownList
Events
SelectedIndexChanged
raised when an item within the DropDownList is selected
FileUpload
Properties
FileBytes
returns the contents of the uploaded file as an array of
bytes
FileContent
returns the contents of the uploaded file as a stream
FileName
returns the name of the file
Licensed to [email protected]
666
Build Your Own ASP.NET 3.5 Web Site Using C# & VB
HasFile
returns True if the control has loaded a file, and False
otherwise
PostedFile
returns for the uploaded file an HttpPostedFile object
whose properties can be used to obtain additional data
about the file
Methods
SaveAs
saves the uploaded file to disk
HiddenField
Properties
Value
specifies the value of the hidden field
HyperLink
Properties
ImageURL
specifies the location of the image to use
NavigateURL
specifies the URL to navigate to when the hyperlink is
clicked
Target
specifies the target window or frame to display for the
URL; possible values are _top, _blank, _self, and _parent
Text
specifies the text displayed by the HyperLink
Visible
controls the visibility of the HyperLink