Spread for ASP.NET 10 Product Documentation
GetDataColumnFromModelColumn Method (IDataSourceSupport)
Example 


Model column index to be converted
Converts the model column index to the data source column index.
Syntax
'Declaration
 
Function GetDataColumnFromModelColumn( _
   ByVal column As Integer _
) As Integer
'Usage
 
Dim instance As IDataSourceSupport
Dim column As Integer
Dim value As Integer
 
value = instance.GetDataColumnFromModelColumn(column)
int GetDataColumnFromModelColumn( 
   int column
)

Parameters

column
Model column index to be converted

Return Value

Integer index of the column in the data source
Example
This example binds the model to a data set.
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.GetDataColumnFromModelColumn(2);
Response.Write("The data column is " + i.ToString());
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.GetDataColumnFromModelColumn(2)
Response.Write("The data column is " & i.ToString())
Requirements

Target Platforms: Windows 7, Windows 8, Windows 10, Windows Vista, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP Professional

See Also

Reference

IDataSourceSupport Interface
IDataSourceSupport Members

 

 


Copyright © GrapeCity, inc. All rights reserved.