Spread for ASP.NET 8.0 Product Documentation
DataKeyField Property (SheetView)
Example 


Gets or sets the data key for this sheet.
Syntax
'Declaration
 
Public Property DataKeyField As Object
'Usage
 
Dim instance As SheetView
Dim value As Object
 
instance.DataKeyField = value
 
value = instance.DataKeyField
public object DataKeyField {get; set;}

Property Value

Object containing the data key
Remarks

This property is available at run time only.

This property gets or sets the DataKeyField object for this sheet. This property gets the identifier for a row.

Example
This example binds the SheetView to a database using several of its properties.
FarPoint.Web.Spread.SheetView sv = FpSpread1.ActiveSheetView;
string conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=d:\\nwind.mdb";
string sqlStr = "SELECT * FROM Employees";
System.Data.OleDb.OleDbConnection conn  = new System.Data.OleDb.OleDbConnection(conStr);
DataSet ds = new DataSet();
System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn);
sv.DataMember = "Employees";
da.Fill(ds, sv.DataMember);
sv.DataSource = ds;
conn.Close();
sv.DataKeyField = "LastName";
Dim sv As FarPoint.Web.Spread.SheetView
sv = FpSpread1.ActiveSheetView
Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=d:\\nwind.mdb"
Dim sqlStr As String = "SELECT * FROM Employees"
Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(conStr)
Dim ds As DataSet = New DataSet()
Dim da As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn)
sv.DataMember = "Employees"
da.Fill(ds, sv.DataMember)
sv.DataSource = ds
conn.Close()
sv.DataKeyField = "LastName"
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

Reference

SheetView Class
SheetView Members
DataKeyField Property

User-Task Documentation

Managing Data Binding

 

 


Copyright © GrapeCity, inc. All rights reserved.