FarPoint.Web.Spread.Model 名前空間 > DefaultSheetDataModel クラス : GetKey メソッド |
UseRowIndexプロパティがtrueに設定されている場合、メソッドは指定した行のキーを生成します。それ以外の場合、GetKeyメソッドは指定した列のキーを生成します。
Dim ds As New System.Data.DataSet() Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Me.IsPostBack Then Return CreateDataSet() FpSpread1.Sheets(0).DataSource = ds FpSpread1.Sheets(0).DataMember = "names" FpSpread1.Sheets(0).DataKeyField = "first" Dim dm As FarPoint.Web.Spread.Model.DefaultSheetDataModel = CType(FpSpread1.ActiveSheetView.DataModel, FarPoint.Web.Spread.Model.DefaultSheetDataModel) ListBox1.Items.Add(dm.GetKey(0)) End Sub Private Sub CreateDataSet() Dim names As DataTable names = ds.Tables.Add("names") names.Columns.Add("first") names.Columns.Add("last") names.Columns.Add("index") names.Rows.Add(NewObject(){"bob", "morris", 0}) names.Rows.Add(NewObject(){"sean", "morris", 1}) names.Rows.Add(NewObject(){"chris", "morris", 2}) End Sub
System.Data.DataSetds = newSystem.Data.DataSet(); private void Page_Load(object sender,System.EventArgs e) { if (this.IsPostBack) return; CreateDataSet(); FpSpread1.Sheets[0].DataSource = ds; FpSpread1.Sheets[0].DataMember = "names"; FpSpread1.Sheets[0].DataKeyField = "first"; FarPoint.Web.Spread.Model.DefaultSheetDataModel dm = (FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel; ListBox1.Items.Add(dm.GetKey(0).ToString()); } private void CreateDataSet() { DataTable names; names = ds.Tables.Add("names"); names.Columns.Add("first"); names.Columns.Add("last"); names.Columns.Add("index"); names.Rows.Add(newobject[]{"bob", "morris", 0}); names.Rows.Add(newobject[]{"sean", "morris", 1}); names.Rows.Add(newobject[]{"chris", "morris", 2}); }