Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
If(IsPostBack)Then Return
Dim dsAs New System.Data.DataSet()
Dim dm As New FarPoint.Web.Spread.Model.DefaultSheetDataModel()
FpSpread1.ActiveSheetView.DataModel=dm
Dim emp As DataTable=New DataTable("Employee")
Dim lname As DataColumn=New DataColumn("LastName",GetType(System.String))
Dim fname As DataColumn=New DataColumn("FirstName",GetType(System.String))
Dim id As DataColumn=emp.Columns.Add("ID",GetType(System.Int32))
id.AutoIncrement=True
Dim primarykey As DataColumn()=New DataColumn(){id}
emp.PrimaryKey=primarykey
emp.Columns.Add(lname)
emp.Columns.Add(fname)
ds.Tables.Add(emp)
Dim ti As DataRow=emp.NewRow()
ti(lname)="Bazemoreland"
ti(fname)="Ti"
emp.Rows.Add(ti)
Dim ginny As DataRow=emp.NewRow()
ginny(lname)="Danielson"
ginny(fname)="Ginny"
emp.Rows.Add(ginny)
Dim bob As DataRow=emp.NewRow()
bob(lname)="Morrison"
bob(fname)="Bob"
emp.Rows.Add(bob)
ds.AcceptChanges()
dm.DataSource=ds
dm.SetModelDataColumn(0,"FirstName")
dm.SetModelDataColumn(2,0)
End Sub
private void Page_Load(object sender,System.EventArgs e)
{
if(this.IsPostBack)return;
System.Data.DataSet ds=new System.Data.DataSet();
FarPoint.Web.Spread.Model.DefaultSheetDataModel dm=new FarPoint.Web.Spread.Model.DefaultSheetDataModel();
FpSpread1.ActiveSheetView.DataModel=dm;
DataTable emp=new DataTable("Employee");
DataColumn lname=new DataColumn("LastName",typeof(String));
DataColumn fname=new DataColumn("FirstName",typeof(String));
DataColumn id=emp.Columns.Add("ID",typeof(Int32));
id.AutoIncrement=true;
emp.PrimaryKey=new DataColumn[]{id};
emp.Columns.Add(lname);
emp.Columns.Add(fname);
ds.Tables.Add(emp);
DataRow ti=emp.NewRow();
ti[lname]="Bazemoreland";
ti[fname]="Ti";
emp.Rows.Add(ti);
DataRow ginny=emp.NewRow();
ginny[lname]="Danielson";
ginny[fname]="Ginny";
emp.Rows.Add(ginny);
DataRow bob=emp.NewRow();
bob[lname]="Morrison";
bob[fname]="Bob";
emp.Rows.Add(bob);
ds.AcceptChanges();
dm.DataSource=ds;
dm.SetModelDataColumn(0,"FirstName");
dm.SetModelDataColumn(2,0);
}