Kiran_M
asked on
How do i check if a particular column exists in the datagrid?
The method i am working with takes the following param
myMethod (object sender, DataGridItemEventArgs e)
{
}
The controls on this grid gets dynamically added.
How do i check if a particular column exists on the grid in this method.
myMethod (object sender, DataGridItemEventArgs e)
{
}
The controls on this grid gets dynamically added.
How do i check if a particular column exists on the grid in this method.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I apologize for the late response. I was able to check the column value by doing
e.Item.Cells[ColPos].Text != "0"
The downside to this is - if i add new column to the grid before this column then ColPos has to be changed. This is NOT the best solution, but it works fine.
I wanted to get the rowcolumn by name, i am not able get it to work.
e.Item.Cells[ColPos].Text != "0"
The downside to this is - if i add new column to the grid before this column then ColPos has to be changed. This is NOT the best solution, but it works fine.
I wanted to get the rowcolumn by name, i am not able get it to work.
DataGridItemEventArgs e : e has a property Item. The Item property returns DataGridItem class instance. This instance has a property Parent. Try to cast it to a DataGrid (?), and them iterate through columns of the data grid.