Access to DataField of DataGrid

P

paolo.ponzano

Hello everybody,

I'm trying (till now with no success) to access at DataField property
of a DataGrid.
I explain you my situation.

I've a DataGrid, called DataGrid1 that's binded to an arraylist.
I need to get che DataField value of each Column before the arraylist
is bounded.
I've seen that using that :

object c = DataGrid1.Columns.GetEnumerator();

I get all the items I need into c, but I'm not sure it's the best
way...

any suggestion?

thanks
 
P

paolo.ponzano

ok, I've succeded in, here's my solution


foreach(object dc in DataGrid1.Columns)
{
if(dc is BoundColumn)
{
if(((BoundColumn)dc).Visible)
{
string c = ((BoundColumn)dc).DataField;
string d = ((BoundColumn)dc).HeaderText;

myHashtable.Add(c, d);
}

}
}
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top