System.Web.UI.WebControls Namespace FormView Class
.NET Framework version 2.0
Returns a FormViewRow object that represents a data row in a FormView control.
Script |
[ FormViewRow variable = ] FormView.Row |
This property can only be used programmatically; it cannot be set when declaring the control.
The property is read only with no default value.
Use the Row property to programmatically access the FormViewRow object that represents a data row in a FormView control.
A data row may display different content based on the template rendered for the CurrentMode. Only the contents of the template in the current mode are accessible.
The following table shows which template is used for each mode.
NOTE: The Row property is available only after the FormView control creates the data row in the ItemCreated event.
This property is commonly used when you need to programmatically manipulate the data row, for example when adding custom content. Any modification to the Row property must be performed after the FormViewRow object that represents the data row has been created; otherwise, the FormView control overwrites any changes.
To control the style of the data row, use the RowStyle property.
The following example demonstrates how to programmatically set the style properties of the Row in the FormView control at run time.
void chgSelectedProps ( Object src, EventArgs e ) {
if ( productView.Row != null ) {
productView.Row.BackColor = System.Drawing.Color.Khaki;
productView.Row.ForeColor = System.Drawing.Color.Maroon;
productView.Row.Font-Bold = true;
}
}
Sub chgSelectedProps ( src As Object, e As EventArgs )
If Not ( productView.Row Is Nothing ) Then
productView.Row.BackColor = System.Drawing.Color.Khaki
productView.Row.ForeColor = System.Drawing.Color.Maroon
productView.Row.Font-Bold = True
End If
End Sub |
|
C# |
VB |
FormViewRow BottomPagerRow FooterRow HeaderRow TopPagerRow