Performing Data Access in
Performing Data Access in
NET) Unit – 1
Note : Use msdn.microsoft.com for more details about all controls theory and examples
SqlConnection
Constructors
Name Description
Initializes a new instance of the SqlConnection class when given a string that contains
SqlConnection(String)
the connection string.
Initializes a new instance of the SqlConnection class given a connection string, that
SqlConnection(String,
does not use Integrated Security = true and a SqlCredential object that contains the
SqlCredential)
user ID and password.
Properties
Name Description
Gets or sets the string used to open a SQL Server database. (Overrides
ConnectionString
DbConnection.ConnectionString.)
Gets the time to wait while trying to establish a connection before terminating the attempt and
ConnectionTimeout
generating an error. (Overrides DbConnection.ConnectionTimeout.)
Credential Gets or sets the SqlCredential object for this connection.
Gets the name of the current database or the database to be used after a connection is opened.
Database
(Overrides DbConnection.Database.)
Gets the name of the instance of SQL Server to which to connect. (Overrides
DataSource
DbConnection.DataSource.)
Methods
Name Description
Closes the connection to the database. This is the preferred method of closing any open connection.
Close
(Overrides DbConnection.Close().)
Opens a database connection with the property settings specified by the ConnectionString. (Overrides
Open
DbConnection.Open().)
SqlCommand
Constructors
Name Description
SqlCommand() Initializes a new instance of the SqlCommand class.
SqlCommand(String) Initializes a new instance of the SqlCommand class with the text of the query.
SqlCommand(String, Initializes a new instance of the SqlCommand class with the text of the query and
SqlConnection) a SqlConnection.
Properties
Name Description
Gets or sets the Transact-SQL statement, table name or stored procedure to execute at the data
CommandText
source. (Overrides DbCommand.CommandText.)
Gets or sets the wait time before terminating the attempt to execute a command and generating
CommandTimeout
an error. (Overrides DbCommand.CommandTimeout.)
Gets or sets a value indicating how the CommandText property is to be interpreted. (Overrides
CommandType
DbCommand.CommandType.)
Connection Gets or sets the SqlConnection used by this instance of the SqlCommand.
Parameters Gets the SqlParameterCollection.
Methods
Name Description
Cancel() Tries to cancel the execution of a SqlCommand. (Overrides DbCommand.Cancel().)
CreateParameter() Creates a new instance of a SqlParameter object.
Executes a Transact-SQL statement against the connection and returns the number of
ExecuteNonQuery()
rows affected. (Overrides DbCommand.ExecuteNonQuery().)
ExecuteReader() Sends the CommandText to the Connection and builds a SqlDataReader.
Executes the query, and returns the first column of the first row in the result set returned
ExecuteScalar() by the query. Additional columns or rows are ignored. (Overrides
DbCommand.ExecuteScalar().)
ResetCommandTimeout() Resets the CommandTimeout property to its default value.
SqlDataAdapter
Constructors
Name Description
SqlDataAdapter() Initializes a new instance of the SqlDataAdapter class.
Initializes a new instance of the SqlDataAdapter class with the specified
SqlDataAdapter(SqlCommand)
SqlCommand as the SelectCommand property.
SqlDataAdapter(String, Initializes a new instance of the SqlDataAdapter class with a SelectCommand
SqlConnection) and a SqlConnection object.
Initializes a new instance of the SqlDataAdapter class with a SelectCommand
SqlDataAdapter(String, String)
and a connection string.
Properties
Name Description
DeleteCommand Gets or sets a Transact-SQL statement or stored procedure to delete records from the data set.
Gets or sets a Transact-SQL statement or stored procedure to insert new records into the data
InsertCommand
source.
Gets or sets a Transact-SQL statement or stored procedure used to select records in the data
SelectCommand
source.
Gets or sets a Transact-SQL statement or stored procedure used to update records in the data
UpdateCommand
source.
Methods
Name Description
Adds or refreshes rows in the DataSet to match those in the data
Fill(DataSet)
source.
DataSet
Constructors
Name Description
DataSet() Initializes a new instance of the DataSet class.
DataSet(String) Initializes a new instance of a DataSet class with the given name.
Properties
Tables Gets the collection of tables contained in the DataSet.
Methods
Name Description
Commits all the changes made to this DataSet since it was loaded or since the last time
AcceptChanges
AcceptChanges was called.
Clear Clears the DataSet of any data by removing all rows in all tables.
Copy Copies both the structure and data for this DataSet.
Gets a copy of the DataSet that contains all changes made to it since it was loaded or since
GetChanges()
AcceptChanges was last called.
GetDataSetSchema Infrastructure. Gets a copy of XmlSchemaSet for the DataSet.
Gets a value indicating whether the DataSet has changes, including new, deleted, or modified
HasChanges()
rows.
Merge(DataRow[]) Merges an array of DataRow objects into the current DataSet.
Compiled By : Dr. Paresh Tanna – School of Engineering, RK University 4
ENTERPRISE COMPUTING THROUGH .NET FRAMEWORKS (.NET) Unit – 1
Merge(DataSet) Merges a specified DataSet and its schema into the current DataSet.
Merge(DataTable) Merges a specified DataTable and its schema into the current DataSet.
Merge(DataSet, Merges a specified DataSet and its schema into the current DataSet, preserving or discarding
Boolean) any changes in this DataSet according to the given argument.
Rolls back all the changes made to the DataSet since it was created, or since the last time
RejectChanges
DataSet.AcceptChanges was called.
Resets the DataSet to its original state. Subclasses should override Reset to restore a DataSet
Reset
to its original state.
SqlDataReader
Properties
Name Description
FieldCount Gets the number of columns in the current row. (Overrides DbDataReader.FieldCount.)
Gets a value that indicates whether the SqlDataReader contains one or more rows. (Overrides
HasRows
DbDataReader.HasRows.)
Retrieves a Boolean value that indicates whether the specified SqlDataReader instance has been
IsClosed
closed. (Overrides DbDataReader.IsClosed.)
Gets the value of the specified column in its native format given the column ordinal. (Overrides
Item[Int32]
DbDataReader.Item.)
Gets the value of the specified column in its native format given the column name. (Overrides
Item[String]
DbDataReader.Item.)
Gets the number of rows changed, inserted, or deleted by execution of the Transact-SQL
RecordsAffected
statement. (Overrides DbDataReader.RecordsAffected.)
Gets the number of fields in the SqlDataReader that are not hidden. (Overrides
VisibleFieldCount
DbDataReader.VisibleFieldCount.)
Methods
Name Description
Close Closes the SqlDataReader object. (Overrides DbDataReader.Close().)
Gets the value of the specified column as a Boolean. (Overrides
GetBoolean
DbDataReader.GetBoolean(Int32).)
GetByte Gets the value of the specified column as a byte. (Overrides DbDataReader.GetByte(Int32).)
Reads a stream of bytes from the specified column offset into the buffer an array starting at the
GetBytes
given buffer offset. (Overrides DbDataReader.GetBytes(Int32, Int64, Byte[], Int32, Int32).)
Gets the value of the specified column as a single character. (Overrides
GetChar
DbDataReader.GetChar(Int32).)
Reads a stream of characters from the specified column offset into the buffer as an array
GetChars starting at the given buffer offset. (Overrides DbDataReader.GetChars(Int32, Int64, Char[], Int32,
Int32).)
Gets a string representing the data type of the specified column. (Overrides
GetDataTypeName
DbDataReader.GetDataTypeName(Int32).)
Gets the value of the specified column as a DateTime object. (Overrides
GetDateTime
DbDataReader.GetDateTime(Int32).)
Gets the value of the specified column as a Decimal object. (Overrides
GetDecimal
DbDataReader.GetDecimal(Int32).)
Gets the value of the specified column as a double-precision floating point number. (Overrides
GetDouble
DbDataReader.GetDouble(Int32).)
GetFieldType Gets the Type that is the data type of the object. (Overrides DbDataReader.GetFieldType(Int32).)
Gets the value of the specified column as a single-precision floating point number. (Overrides
GetFloat
DbDataReader.GetFloat(Int32).)
Gets the value of the specified column as a 16-bit signed integer. (Overrides
GetInt16
DbDataReader.GetInt16(Int32).)
Gets the value of the specified column as a 32-bit signed integer. (Overrides
GetInt32
DbDataReader.GetInt32(Int32).)
Gets the value of the specified column as a 64-bit signed integer. (Overrides
GetInt64
DbDataReader.GetInt64(Int32).)
GetName Gets the name of the specified column. (Overrides DbDataReader.GetName(Int32).)
Gets the column ordinal, given the name of the column. (Overrides
GetOrdinal
DbDataReader.GetOrdinal(String).)
Gets the value of the specified column in its native format. (Overrides
GetValue
DbDataReader.GetValue(Int32).)
Populates an array of objects with the column values of the current row. (Overrides
GetValues
DbDataReader.GetValues(Object[]).)
Read Advances the SqlDataReader to the next record. (Overrides DbDataReader.Read().)
SqlDataSource
Constuctors
Name Description
SqlDataSource() Initializes a new instance of the SqlDataSource class.
Initializes a new instance of the SqlDataSource class with the specified connection
SqlDataSource(String, String)
string and Select command.
SqlDataSource(String, String, Initializes a new instance of the SqlDataSource class with the specified connection
String) string and Select command.
Properties
Name Description
Gets or sets the ADO.NET provider–specific connection string that the SqlDataSource control
ConnectionString
uses to connect to an underlying database.
Gets or sets the name of the .NET Framework data provider that the SqlDataSource control
ProviderName
uses to connect to an underlying data source.
Gets or sets the SQL string that the SqlDataSource control uses to retrieve data from the
SelectCommand
underlying database.
Gets or sets a value indicating whether the text in the SelectCommand property is an SQL
SelectCommandType
query or the name of a stored procedure.
Gets or sets the SQL string that the SqlDataSource control uses to insert data into the
InsertCommand
underlying database.
Gets or sets a value indicating whether the text in the InsertCommand property is an SQL
InsertCommandType
statement or the name of a stored procedure.
Gets or sets the SQL string that the SqlDataSource control uses to delete data from the
DeleteCommand
underlying database.
Gets or sets a value indicating whether the text in the DeleteCommand property is an SQL
DeleteCommandType
statement or the name of a stored procedure.
Gets or sets the SQL string that the SqlDataSource control uses to update data in the
UpdateCommand
underlying database.
Gets or sets a value indicating whether the text in the UpdateCommand property is an SQL
UpdateCommandType
statement or the name of a stored procedure.
FilterExpression Gets or sets a filtering expression that is applied when the Select method is called.
Methods
Name Description
DataBind() Binds a data source to the invoked server control and all its child controls. (Inherited from Control.)
Retrieves data from the underlying database by using the SelectCommand SQL string and any
Select
parameters that are in the SelectParameters collection.
Performs an insert operation using the InsertCommand SQL string and any parameters that are in the
Insert
InsertParameters collection.
Performs an update operation using the UpdateCommand SQL string and any parameters that are in the
Update
UpdateParameters collection.
Performs a delete operation using the DeleteCommand SQL string and any parameters that are in the
Delete
DeleteParameters collection.
GridView Control
Properties
Name Description
AllowPaging Gets or sets a value indicating whether the paging feature is enabled.
AllowSorting Gets or sets a value indicating whether the sorting feature is enabled.
Gets a reference to the TableItemStyle object that enables you to set the appearance of
AlternatingRowStyle
alternating data rows in a GridView control.
Gets or sets a value indicating whether bound fields are automatically created for each
AutoGenerateColumns
field in the data source.
Gets or sets a value indicating whether a CommandField field column with a Delete
AutoGenerateDeleteButton
button for each data row is automatically added to a GridView control.
Gets or sets a value indicating whether a CommandField field column with an Edit
AutoGenerateEditButton
button for each data row is automatically added to a GridView control.
Gets or sets a value indicating whether a CommandField field column with a Select
AutoGenerateSelectButton
button for each data row is automatically added to a GridView control.
BackImageUrl Gets or sets the URL to an image to display in the background of a GridView control.
Gets or sets the text to render in an HTML caption element in a GridView control. This
Caption property is provided to make the control more accessible to users of assistive
technology devices.
Gets or sets the horizontal or vertical position of the HTML caption element in a
CaptionAlign GridView control. This property is provided to make the control more accessible to
users of assistive technology devices.
CellPadding Gets or sets the amount of space between the contents of a cell and the cell's border.
CellSpacing Gets or sets the amount of space between cells.
Gets a collection of DataControlField objects that represent the column fields in a
Columns
GridView control.
Gets or sets an array that contains the names of the primary key fields for the items
DataKeyNames
displayed in a GridView control.
Gets a collection of DataKey objects that represent the data key value of each row in a
DataKeys
GridView control.
DeleteMethod Gets or sets the name of the method to call in order to delete data.
Gets a reference to the TableItemStyle object that enables you to set the appearance of
EditRowStyle
the row selected for editing in a GridView control.
Gets a reference to the TableItemStyle object that enables you to set the appearance of
EmptyDataRowStyle the empty data row rendered when a GridView control is bound to a data source that
does not contain any records.
EmptyDataText Gets or sets the text to display in the empty data row rendered when a GridView
control is bound to a data source that does not contain any records.
FooterRow Gets a GridViewRow object that represents the footer row in a GridView control.
Gets a reference to the TableItemStyle object that enables you to set the appearance of
FooterStyle
the footer row in a GridView control.
GridLines Gets or sets the gridline style for a GridView control.
HeaderRow Gets a GridViewRow object that represents the header row in a GridView control.
Gets a reference to the TableItemStyle object that enables you to set the appearance of
HeaderStyle
the header row in a GridView control.
HorizontalAlign Gets or sets the horizontal alignment of a GridView control on the page.
Gets the number of pages required to display the records of the data source in a
PageCount
GridView control.
PageIndex Gets or sets the index of the currently displayed page.
Gets a reference to the TableItemStyle object that enables you to set the appearance of
PagerStyle
the pager row in a GridView control.
PageSize Gets or sets the number of records to display on a page in a GridView control.
Gets or sets the name of the column to use as the column header for the GridView
RowHeaderColumn control. This property is provided to make the control more accessible to users of
assistive technology devices.
Gets a collection of GridViewRow objects that represent the data rows in a GridView
Rows
control.
Gets a reference to the TableItemStyle object that enables you to set the appearance of
RowStyle
the data rows in a GridView control.
SelectedIndex Gets or sets the index of the selected row in a GridView control.
Gets a reference to a GridViewRow object that represents the selected row in the
SelectedRow
control.
Gets a reference to the TableItemStyle object that enables you to set the appearance of
SelectedRowStyle
the selected row in a GridView control.
SelectedValue Gets the data key value of the selected row in a GridView control.
Gets or sets a value indicating whether the footer row is displayed in a GridView
ShowFooter
control.
Gets or sets a value indicating whether the header row is displayed in a GridView
ShowHeader
control.
Gets or sets a value that indicates whether the heading of a column in the GridView
ShowHeaderWhenEmpty
control is visible when the column has no data.
SortDirection Gets the sort direction of the column being sorted.
Gets or sets the CSS style for a GridView column when the column is sorted in ascending
SortedAscendingCellStyle
order.
SortExpression Gets the sort expression associated with the column or columns being sorted.
TopPagerRow Gets a GridViewRow object that represents the top pager row in a GridView control.
UpdateMethod Gets or sets the name of the method to call in order to update data.
Events
Name Description
Occurs when one of the pager buttons is clicked, but after the GridView control handles the
PageIndexChanged
paging operation.
Occurs when one of the pager buttons is clicked, but before the GridView control handles
PageIndexChanging
the paging operation.
Occurs when the Cancel button of a row in edit mode is clicked, but before the row exits
RowCancelingEdit
edit mode.
RowCommand Occurs when a button is clicked in a GridView control.
RowCreated Occurs when a row is created in a GridView control.
RowDataBound Occurs when a data row is bound to data in a GridView control.
Occurs when a row's Delete button is clicked, but after the GridView control deletes the
RowDeleted
row.
Occurs when a row's Delete button is clicked, but before the GridView control deletes the
RowDeleting
row.
Occurs when a row's Edit button is clicked, but before the GridView control enters edit
RowEditing
mode.
Occurs when a row's Update button is clicked, but after the GridView control updates the
RowUpdated
row.
Occurs when a row's Update button is clicked, but before the GridView control updates the
RowUpdating
row.
Occurs when a row's Select button is clicked, but after the GridView control handles the
SelectedIndexChanged
select operation.
Occurs when a row's Select button is clicked, but before the GridView control handles the
SelectedIndexChanging
select operation.
Occurs when the hyperlink to sort a column is clicked, but after the GridView control
Sorted
handles the sort operation.
Occurs when the hyperlink to sort a column is clicked, but before the GridView control
Sorting
handles the sort operation.
Methods
Name Description
Binds the data source to the GridView control. This method cannot be inherited. (Overrides
DataBind()
BaseDataBoundControl.DataBind().)
DeleteRow Deletes the record at the specified index from the data source.
SelectRow Selects the row to edit in a GridView control.
SetEditRow Puts a row in edit mode in a GridView control by using the specified row index.
SetPageIndex Sets the page index of the GridView control by using the row index.
Sort Sorts the GridView control based on the specified sort expression and direction.
UpdateRow Updates the record at the specified row index using the field values of the row.
DetailsView control
Constructors
Name Description
Properties
Name Description
AllowPaging Gets or sets a value indicating whether the paging feature is enabled.
Gets a reference to the TableItemStyle object that allows you to set the appearance of
AlternatingRowStyle
the alternating data rows in a DetailsView control.
Gets or sets a value indicating whether the built-in control to delete the current record
AutoGenerateDeleteButton
is displayed in a DetailsView control.
Gets or sets a value indicating whether the built-in controls to edit the current record
AutoGenerateEditButton
are displayed in a DetailsView control.
Gets or sets a value indicating whether the built-in controls to insert a new record are
AutoGenerateInsertButton
displayed in a DetailsView control.
Gets or sets a value indicating whether row fields for each field in the data source are
AutoGenerateRows
automatically generated and displayed in a DetailsView control.
Gets or sets the background color of the Web server control. (Inherited from
BackColor
WebControl.)
BackImageUrl Gets or sets the URL to an image to display in the background of a DetailsView control.
BorderColor Gets or sets the border color of the Web control. (Inherited from WebControl.)
BorderStyle Gets or sets the border style of the Web server control. (Inherited from WebControl.)
BorderWidth Gets or sets the border width of the Web server control. (Inherited from WebControl.)
Gets or sets the text to render in an HTML caption element in a DetailsView control.
Caption This property is provided to make the control more accessible to users of assistive
technology devices.
Gets or sets the horizontal or vertical position of the HTML caption element in a
CaptionAlign DetailsView control. This property is provided to make the control more accessible to
users of assistive technology devices.
CellPadding Gets or sets the amount of space between the contents of a cell and the cell's border.
CellSpacing Gets or sets the amount of space between cells.
Gets or sets the ID of the control from which the data-bound control retrieves its list of
DataSourceID
data items. (Inherited from DataBoundControl.)
DefaultMode Get or sets the default data-entry mode of the DetailsView control.
Gets or sets the name of the method on the page that is called when the control
DeleteMethod
performs a delete operation.
Gets a reference to the TableItemStyle object that allows you to set the appearance of
EditRowStyle
the data rows when a DetailsView control is in edit mode.
Gets or sets the text to display in the empty data row rendered when a DetailsView
EmptyDataText
control is bound to a data source that does not contain any records.
Gets or sets a value indicating whether the Web server control is enabled. (Inherited
Enabled
from WebControl.)
Gets a collection of DataControlField objects that represent the explicitly declared row
Fields
fields in a DetailsView control.
GridLines Gets or sets the gridline style for a DetailsView control.
HeaderText Gets or sets the text to display in the header row of a DetailsView control.
Height Gets or sets the height of the Web server control. (Inherited from WebControl.)
Gets or sets the name of the method on the page that is called when the control
InsertMethod
performs an insert operation.
PageCount Gets the number of records in the data source.
PageIndex Gets or sets the index of the displayed record.
Methods
Name Description
Infrastructure. Calls the DataBind method of the base class. (Overrides
DataBind()
BaseDataBoundControl.DataBind().)
DeleteItem Deletes the current record from the data source.
DataList
Constructors
Name Description
DataList Initializes a new instance of the DataList class.
Properties
Name Description
AlternatingItemStyle Gets the style properties for alternating items in the DataList control.
AlternatingItemTemplate Gets or sets the template for alternating items in the DataList.
Gets or sets the background color of the Web server control. (Inherited from
BackColor
WebControl.)
Gets or sets the text to render in an HTML caption element in the control. This property is
Caption provided to make the control more accessible to users of assistive technology devices.
(Inherited from BaseDataList.)
Gets or sets the horizontal or vertical position of the HTML caption element in a control.
CaptionAlign This property is provided to make the control more accessible to users of assistive
technology devices. (Inherited from BaseDataList.)
Gets or sets the amount of space between the contents of a cell and the cell's border.
CellPadding
(Inherited from BaseDataList.)
CellSpacing Gets or sets the amount of space between cells. (Inherited from BaseDataList.)
Gets or sets the ID property of the data source control that the data listing control should
DataSourceID
use to retrieve its data source. (Inherited from BaseDataList.)
EditItemIndex Gets or sets the index number of the selected item in the DataList control to edit.
EditItemStyle Gets the style properties for the item selected for editing in the DataList control.
EditItemTemplate Gets or sets the template for the item selected for editing in the DataList control.
Gets or sets the grid line style for the DataList control when the RepeatLayout property is
GridLines
set to RepeatLayout.Table. (Overrides BaseDataList.GridLines.)
Gets a collection of DataListItem objects representing the individual items within the
Items
control.
ItemStyle Gets the style properties for the items in the DataList control.
ItemTemplate Gets or sets the template for the items in the DataList control.
RepeatColumns Gets or sets the number of columns to display in the DataList control.
RepeatDirection Gets or sets whether the DataList control displays vertically or horizontally.
RepeatLayout Gets or sets whether the control is displayed in a table or flow layout.
SelectedIndex Gets or sets the index of the selected item in the DataList control.
SelectedItem Gets the selected item in the DataList control.
Compiled By : Dr. Paresh Tanna – School of Engineering, RK University 13
ENTERPRISE COMPUTING THROUGH .NET FRAMEWORKS (.NET) Unit – 1
SelectedItemTemplate Gets or sets the template for the selected item in the DataList control.
SelectedValue Gets the value of the key field for the selected data list item.
SeparatorStyle Gets the style properties of the separator between each item in the DataList control.
SeparatorTemplate Gets or sets the template for the separator between the items of the DataList control.
Gets or sets a value indicating whether the footer section is displayed in the DataList
ShowFooter
control.
Gets or sets a value indicating whether the header section is displayed in the DataList
ShowHeader
control.
Repeater control
Constructors
Name Description
Repeater Initializes a new instance of the Repeater class.
Properties
Name Description
Gets or sets the ID property of the data source control that the Repeater control should use to
DataSourceID
retrieve its data source.
Gets or sets the System.Web.UI.ITemplate that defines how the footer section of the Repeater
FooterTemplate
control is displayed.
Gets or sets the System.Web.UI.ITemplate that defines how the header section of the Repeater
HeaderTemplate
control is displayed.
Items Gets a collection of RepeaterItem objects in the Repeater control.
Gets or sets the System.Web.UI.ITemplate that defines how items in the Repeater control are
ItemTemplate
displayed.
SelectMethod The name of the method to call in order to read data.
Gets or sets the System.Web.UI.ITemplate interface that defines how the separator between
SeparatorTemplate
items is displayed.
Methods
Name Description
Infrastructure. Binds the Repeater control and all its child controls to the specified data source.
DataBind()
(Overrides Control.DataBind().)
ListView control
Constructors
Name Description
ListView Initializes a new instance of the ListView class.
Properties
Name Description
ActualHeight Gets the rendered height of this element. (Inherited from FrameworkElement.)
ActualWidth Gets the rendered width of this element. (Inherited from FrameworkElement.)
Gets or sets a value indicating whether this element can be used as the target of a drag-and-
AllowDrop
drop operation. This is a dependency property. (Inherited from UIElement.)
Gets or sets the number of alternating item containers in the ItemsControl, which enables
AlternationCount
alternating containers to have a unique appearance. (Inherited from ItemsControl.)
Background Gets or sets a brush that describes the background of a control. (Inherited from Control.)
Foreground Gets or sets a brush that describes the foreground color. (Inherited from Control.)
Gets the collection used to generate the content of the ItemsControl. (Inherited from
Items
ItemsControl.)
Gets or sets the template that defines the panel that controls the layout of items. (Inherited
ItemsPanel
from ItemsControl.)
Gets or sets a collection used to generate the content of the ItemsControl. (Inherited from
ItemsSource
ItemsControl.)
Gets or sets a composite string that specifies how to format the items in the ItemsControl if
ItemStringFormat
they are displayed as strings. (Inherited from ItemsControl.)
ItemTemplate Gets or sets the DataTemplate used to display each item. (Inherited from ItemsControl.)
Gets or sets the custom logic for choosing a template used to display each item. (Inherited
ItemTemplateSelector
from ItemsControl.)
Gets or sets the index of the first item in the current selection or returns negative one ( -1) if
SelectedIndex
the selection is empty. (Inherited from Selector.)
Gets or sets the first item in the current selection or returns null if the selection is empty
SelectedItem
(Inherited from Selector.)
SelectedItems Gets the currently selected items. (Inherited from ListBox.)
Gets or sets the value of the SelectedItem, obtained by using SelectedValuePath. (Inherited
SelectedValue
from Selector.)
SelectionMode Gets or sets the selection behavior for a ListBox. (Inherited from ListBox.)
Gets or sets the tool-tip object that is displayed for this element in the user interface (UI).
ToolTip
(Inherited from FrameworkElement.)
FormView control
Constructors
Name Description
FormView Initializes a new instance of the FormView class.
Properties
Name Description
AllowPaging Gets or sets a value indicating whether the paging feature is enabled.
Gets or sets the text to render in an HTML caption element in a FormView control. This
Caption property is provided to make the control more accessible to users of assistive technology
devices.
Gets or sets the horizontal or vertical position of the HTML caption element in a FormView
CaptionAlign control. This property is provided to make the control more accessible to users of assistive
technology devices.
CellPadding Gets or sets the amount of space between the contents of a cell and the cell's border.
CellSpacing Gets or sets the amount of space between cells.
Gets or sets the ID of the control from which the data-bound control retrieves its list of data
DataSourceID
items. (Inherited from DataBoundControl.)
Gets or sets the data-entry mode to which the FormView control returns after an update,
DefaultMode
insert, or cancel operation.
EditItemTemplate Gets or sets the custom content for an item in edit mode.
Gets a reference to the TableItemStyle object that allows you to set the appearance of the data
EditRowStyle
row when a FormView control is in edit mode.
Gets a reference to the TableItemStyle object that allows you to set the appearance of the
EmptyDataRowStyle empty data row displayed when the data source bound to a FormView control does not
contain any records.
Gets or sets the user-defined content for the empty data row rendered when a FormView
EmptyDataTemplate
control is bound to a data source that does not contain any records.
Gets or sets the text to display in the empty data row rendered when a FormView control is
EmptyDataText
bound to a data source that does not contain any records.
FooterRow Gets the FormViewRow object that represents the footer row in a FormView control.
Gets a reference to the TableItemStyle object that allows you to set the appearance of the
FooterStyle
footer row in a FormView control.
FooterTemplate Gets or sets the user-defined content for the footer row in a FormView control.
FooterText Gets or sets the text to display in the footer row of a FormView control.
GridLines Gets or sets the gridline style for a FormView control.
HeaderRow Gets the FormViewRow object that represents the header row in a FormView control.
Gets a reference to the TableItemStyle object that allows you to set the appearance of the
HeaderStyle
header row in a FormView control.
HeaderTemplate Gets or sets the user-defined content for the header row in a FormView control.
HeaderText Gets or sets the text to display in the header row of a FormView control.
Height Gets or sets the height of the Web server control. (Inherited from WebControl.)
HorizontalAlign Gets or sets the horizontal alignment of a FormView control on the page.
Gets a reference to the TableItemStyle object that allows you to set the appearance of the data
InsertRowStyle
row in a FormView control when the control is in insert mode.
PageIndex Gets or sets the index of the displayed page.
Methods
Name Description
ChangeMode Switches the FormView control to the specified data-entry mode.
DataBind() Binds the data source to the FormView control. (Overrides BaseDataBoundControl.DataBind().)
DeleteItem Deletes the current record in the FormView control from the data source.
InsertItem Inserts the current record in the data source.