Spread for ASP.NET 7.0 Product Documentation
SelectMethod Property
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > SheetView Class : SelectMethod Property


Glossary Item Box

Gets or sets the name of the method to call in order to read data.

Syntax

Visual Basic (Declaration) 
Public Property SelectMethod As String
Visual Basic (Usage)Copy Code
Dim instance As SheetView
Dim value As String
 
instance.SelectMethod = value
 
value = instance.SelectMethod
C# 
public string SelectMethod {get; set;}

Example

This example uses the SelectMethod property to load data.
C#Copy Code
Add this to the FarPoint:SheetView section in the ASPX page:
<FarPoint:SheetView SheetName="Sheet1" SelectMethod="GetProducts"  AllowDelete="true" AllowInsert="true">
                </FarPoint:SheetView>

//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 List<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;
  }
VB.NETCopy Code
Add this to the FarPoint:SheetView section in the ASPX page:
<FarPoint:SheetView SheetName="Sheet1" SelectMethod="GetProducts"  AllowDelete="true" AllowInsert="true">
                </FarPoint:SheetView>

'vb code
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 List(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
    End Function

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.