Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > swapping columns on ItemDataBoundEventHandler

Reply
Thread Tools

swapping columns on ItemDataBoundEventHandler

 
 
Tim
Guest
Posts: n/a
 
      04-21-2004
Hi,

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();
ds.Tables.Add(this.GetTable(dr));
DataGrid1.DataSource = ds.Tables[0];

DataGrid1.DataBind();

}

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

dgCol1 = DataGrid1.Columns[0];
dgCol2 = DataGrid1.Columns[1];
DataGrid1.Columns.AddAt(0,dgCol2);
DataGrid1.Columns.AddAt(1,dgCol1);
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
swapping the rows and columns shrikanthraon General Computer Support 0 08-14-2009 04:19 PM
Swapping of columns and rows in gridview shrikanthraon ASP .Net 0 08-09-2009 09:05 AM
ItemDataBoundEventHandler =?Utf-8?B?TXJNaWtl?= ASP .Net 7 12-01-2004 08:33 PM
better way of swapping columns and rows in a table (code provided) foldface@yahoo.co.uk Javascript 1 09-08-2004 07:36 AM
Swapping columns in a DataGrid Tim ASP .Net Datagrid Control 1 04-16-2004 01:03 AM



Advertisments