swapping columns on ItemDataBoundEventHandler

Discussion in 'ASP .Net Datagrid Control' started by Tim, Apr 21, 2004.

  1. Tim

    Tim Guest


    In the below code, a count of the DataGrid1.Columns yields zero
    columns even after the ItemDataBound event is raised; otherwise,
    DataGrid1.DataBind() works fine if I comment out
    ItemDataBoundEventHandler as a datagrid with 8 columns and 20 rows is
    rendered. In the GetTable(OleDBDataReader) function, I take a dataset
    and append a column that displays the row- count at the very front of
    the datagrid. I want to swap this row-count column with the first
    column of the dataset.

    DataSet ds = new DataSet();
    DataGrid1.DataSource = ds.Tables[0];



    void ItemDataBoundEventHandler(object sender, DataGridItemEventArgs e)
    DataGridColumn dgCol1;
    DataGridColumn dgCol2;

    dgCol1 = DataGrid1.Columns[0];
    dgCol2 = DataGrid1.Columns[1];
    Tim, Apr 21, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.