Spread for ASP.NET 7.0 Product Documentation
GetModelColumnFromDataColumn Method
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > IDataSourceSupport Interface : GetModelColumnFromDataColumn Method


column
Data source column index to be converted

Glossary Item Box

Converts the data source column index to the model column index.

Syntax

Visual Basic (Declaration) 
Function GetModelColumnFromDataColumn( _
   ByVal column As Integer _
) As Integer
Visual Basic (Usage)Copy Code
Dim instance As IDataSourceSupport
Dim column As Integer
Dim value As Integer
 
value = instance.GetModelColumnFromDataColumn(column)
C# 
int GetModelColumnFromDataColumn( 
   int column
)

Parameters

column
Data source column index to be converted

Return Value

Integer index of the column in the model

Example

This example binds the model to a data set.
C#Copy Code
string strConn  = "data source = 127.0.0.1;initial catalog=Pubs; integrated security = SSPI";
string sqlStr = "SELECT * FROM Authors; Select * From Titles";

System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(sqlStr, strConn);
DataSet ds = new DataSet();
da.Fill(ds);

FarPoint.Web.Spread.Model.IDataSourceSupport dss;
dss = (FarPoint.Web.Spread.Model.IDataSourceSupport)FpSpread1.ActiveSheetView.DataModel;
dss.AutoGenerateColumns = true;
dss.DataSource = ds;
dss.DataMember = "Table";
dss.DataKeyField = "auid";

int i;
i = dss.GetModelColumnFromDataColumn(2);
Response.Write("The model column is " + i.ToString());
Visual BasicCopy Code
Dim strConn As String = "data source = 127.0.0.1;initial catalog=Pubs; integrated security = SSPI"
Dim sqlStr As String = "SELECT * FROM Authors; Select * From Titles"

Dim da As New System.Data.SqlClient.SqlDataAdapter(sqlStr, strConn)
Dim ds As New DataSet
da.Fill(ds)

Dim dss As FarPoint.Web.Spread.Model.IDataSourceSupport
dss = FpSpread1.ActiveSheetView.DataModel
dss.AutoGenerateColumns = True
dss.DataSource = ds
dss.DataMember = "Table"
dss.DataKeyField = "auid"

Dim i As Integer
i = dss.GetModelColumnFromDataColumn(2)
Response.Write("The model column is " & i.ToString())

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.