Spread for ASP.NET 11 Product Documentation
Sheet Property (PreviewRowTemplateContainer)
Example 


FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > PreviewRowTemplateContainer Class : Sheet Property
Gets the sheet.
Syntax
'Declaration
 
Public ReadOnly Property Sheet As SheetView
'Usage
 
Dim instance As PreviewRowTemplateContainer
Dim value As SheetView
 
value = instance.Sheet
public SheetView Sheet {get;}

Property Value

SheetView that contains the sheet
Example
This example sets a preview row and the preview row template container.
FarPoint.Web.Spread.Background bg = new FarPoint.Web.Spread.Background();
bg.SelectedBackgroundImageUrl = "picture/Winter.jpg";
bg.BackgroundImageUrl = "picture/Image.bmp";
FarPoint.Web.Spread.Border bd1 = new FarPoint.Web.Spread.Border();
bd1.BorderColor = System.Drawing.Color.Blue;
bd1.BorderStyle = System.Web.UI.WebControls.BorderStyle.Dashed;

FpSpread1.ActiveSheetView.PreviewRowColumnIndex = 0;
FpSpread1.ActiveSheetView.PreviewRowStyle.BackColor = Color.Pink;
FpSpread1.ActiveSheetView.PreviewRowStyle.Background = bg;
FpSpread1.ActiveSheetView.PreviewRowStyle.Border = bd1;
FpSpread1.ActiveSheetView.PreviewRowStyle.CssClass = "CssStyle1";
FpSpread1.ActiveSheetView.PreviewRowStyle.Font.Bold = true;
FpSpread1.ActiveSheetView.PreviewRowStyle.Font.Name = "Aharoni";
FpSpread1.ActiveSheetView.PreviewRowStyle.ForeColor = Color.Blue;
FpSpread1.ActiveSheetView.PreviewRowStyle.HorizontalAlign =  HorizontalAlign.Center;
FpSpread1.ActiveSheetView.PreviewRowStyle.Margin.Bottom = 10;
FpSpread1.ActiveSheetView.PreviewRowStyle.Margin.Left = 10;
FpSpread1.ActiveSheetView.PreviewRowStyle.Margin.Right = 10;
FpSpread1.ActiveSheetView.PreviewRowStyle.Margin.Top = 10;
FpSpread1.ActiveSheetView.PreviewRowStyle.TabStop = false;
FpSpread1.ActiveSheetView.PreviewRowStyle.VerticalAlign = VerticalAlign.Middle;
 FpSpread1.ActiveSheetView.PreviewRowVisible = true;

// for PreviewRowTemplate, in this case we need to create one Web User Control with name: PreviewRowTemplate, 
// suppose that we have one listbox in the page of Web User Control, then we can add following code in the Page_Load()
PreviewRowTemplateContainer c = this.Parent as PreviewRowTemplateContainer;
if (c != null)
{
    this.ListBox1.Items.Clear();
    for (int col = 0; col < c.Sheet.ColumnCount; col++)
    {
             this.ListBox1.Items.Add(c.Sheet.Cells[c.RowIndex, col].Text);
    }
}

//in your page, you can run this code to load that template in the preview row
FpSpread1.ActiveSheetView.PreviewRowTemplate =     LoadTemplate("PreviewRowTemplate.ascx");
FpSpread1.ActiveSheetView.PreviewRowVisible = true;
Dim bg As New FarPoint.Web.Spread.Background()
bg.SelectedBackgroundImageUrl = "picture/Winter.jpg"
bg.BackgroundImageUrl = "picture/Image.bmp"
Dim bd1 As New FarPoint.Web.Spread.Border()
bd1.BorderColor = System.Drawing.Color.Blue
bd1.BorderStyle = System.Web.UI.WebControls.BorderStyle.Dashed

FpSpread1.ActiveSheetView.PreviewRowColumnIndex = 0
FpSpread1.ActiveSheetView.PreviewRowStyle.BackColor = Color.Pink
FpSpread1.ActiveSheetView.PreviewRowStyle.Background = bg
FpSpread1.ActiveSheetView.PreviewRowStyle.Border = bd1
FpSpread1.ActiveSheetView.PreviewRowStyle.CssClass = "CssStyle1"
FpSpread1.ActiveSheetView.PreviewRowStyle.Font.Bold = True
FpSpread1.ActiveSheetView.PreviewRowStyle.Font.Name = "Aharoni"
FpSpread1.ActiveSheetView.PreviewRowStyle.ForeColor = Color.Blue
FpSpread1.ActiveSheetView.PreviewRowStyle.HorizontalAlign = HorizontalAlign.Center
FpSpread1.ActiveSheetView.PreviewRowStyle.Margin.Bottom = 10
FpSpread1.ActiveSheetView.PreviewRowStyle.Margin.Left = 10
FpSpread1.ActiveSheetView.PreviewRowStyle.Margin.Right = 10
FpSpread1.ActiveSheetView.PreviewRowStyle.Margin.Top = 10
FpSpread1.ActiveSheetView.PreviewRowStyle.TabStop = False
FpSpread1.ActiveSheetView.PreviewRowStyle.VerticalAlign = VerticalAlign.Middle
FpSpread1.ActiveSheetView.PreviewRowVisible = True

' for PreviewRowTemplate, in this case we need to create one Web User Control with name: PreviewRowTemplate,
' suppose that we have one listbox in the page of Web User Control, then we can add following code in the Page_Load()
Dim c As PreviewRowTemplateContainer = TryCast(Me.Parent, PreviewRowTemplateContainer)
If c IsNot Nothing Then
    Me.ListBox1.Items.Clear()
    For col As Integer = 0 To c.Sheet.ColumnCount - 1
        Me.ListBox1.Items.Add(c.Sheet.Cells(c.RowIndex, col).Text)
    Next
End If

'in your page, you can run this code to load that template in the preview row
FpSpread1.ActiveSheetView.PreviewRowTemplate = LoadTemplate("PreviewRowTemplate.ascx")
FpSpread1.ActiveSheetView.PreviewRowVisible = True
See Also

Reference

PreviewRowTemplateContainer Class
PreviewRowTemplateContainer Members