Spread for ASP.NET 11 Product Documentation
ItemType Property (SheetView)
Example 


FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > SheetView Class : ItemType Property
Gets or sets the name of the data item type in model binding.
Syntax
'Declaration
 
Public Property ItemType As String
'Usage
 
Dim instance As SheetView
Dim value As String
 
instance.ItemType = value
 
value = instance.ItemType
public string ItemType {get; set;}
Remarks
The ItemType property allows you to use strongly-typed binding in the bound control. This property can also be used to declare the type of data the control is bound to. The SelectMethod should return the correct type when setting the ItemType property.
Example
This example sets the ItemType property.
<FarPoint:FpSpread ID="FpSpread1" ItemType="spweb7vb2012.WebForm1+Product" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Height="200" Width="400">
            <commandbar backcolor="Control" buttonfacecolor="Control" buttonhighlightcolor="ControlLightLight" buttonshadowcolor="ControlDark">
            </commandbar>
            <sheets>
                <FarPoint:SheetView SheetName="Sheet1" AllowDelete="true" AllowInsert="true" SelectMethod="GetProducts" DeleteMethod="DeleteUser" InsertMethod="InsertUser" UpdateMethod="UpdateUser">
                </FarPoint:SheetView>
            </sheets>
        </FarPoint:FpSpread>

//cs code
public class Product
{
  public string Name { get; set; }
  public string Desc { get; set; }

  public Product(string name, string desc)
  {
    this.Name = name;
    this.Desc = desc;
  }
}

public IQueryable<Product> GetProducts()
{
    List<Product> ls = new List<Product>();
    ls.Add(new Product("Pro1", "ProDesc1"));
    ls.Add(new Product("Pro2", "ProDesc2"));
    ls.Add(new Product("Pro3", "ProDesc3"));
    return ls.AsQueryable();
}
<FarPoint:FpSpread ID="FpSpread1" ItemType="spweb7vb2012.WebForm1+Product" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Height="200" Width="400">
            <commandbar backcolor="Control" buttonfacecolor="Control" buttonhighlightcolor="ControlLightLight" buttonshadowcolor="ControlDark">
            </commandbar>
            <sheets>
                <FarPoint:SheetView SheetName="Sheet1" AllowDelete="true" AllowInsert="true" SelectMethod="GetProducts" DeleteMethod="DeleteUser" InsertMethod="InsertUser" UpdateMethod="UpdateUser">
                </FarPoint:SheetView>
            </sheets>
        </FarPoint:FpSpread>


Public Class Product
        Public Property Name() As String
            Get
                Return m_Name
            End Get
            Set(value As String)
                m_Name = value
            End Set
        End Property
        Private m_Name As String
        Public Property Desc() As String
            Get
                Return m_Desc
            End Get
            Set(value As String)
                m_Desc = value
            End Set
        End Property
        Private m_Desc As String

        Public Sub New(name As String, desc As String)
            Me.Name = name
            Me.Desc = desc
        End Sub
    End Class

 Public Function GetProducts() As IQueryable(Of Product)
        Dim ls As New List(Of Product)()
        ls.Add(New Product("Pro1", "ProDesc1"))
        ls.Add(New Product("Pro2", "ProDesc2"))
        ls.Add(New Product("Pro3", "ProDesc3"))
        Return ls.AsQueryable()
    End Function
See Also

Reference

SheetView Class
SheetView Members