Spread for ASP.NET 13 Product Documentation
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread.Model Namespace / IDataSourceSupport Interface / GetModelColumnFromDataColumn Method
Data source column index to be converted

In This Topic
    GetModelColumnFromDataColumn Method (IDataSourceSupport)
    In This Topic
    Converts the data source column index to the model column index.
    Function GetModelColumnFromDataColumn( _
       ByVal column As Integer _
    ) As Integer
    Dim instance As IDataSourceSupport
    Dim column As Integer
    Dim value As Integer
    value = instance.GetModelColumnFromDataColumn(column)
    int GetModelColumnFromDataColumn( 
       int column


    Data source column index to be converted

    Return Value

    Integer index of the column in the model
    This example binds the model to a data set.
    string strConn  = "data source =;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();
    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());
    Dim strConn As String = "data source =;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
    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())
    See Also