ppeterso
asked on
How to access gridview DataRow field to conditionally set Gridview Header field
I have a gridview. One of my dataRow fields holds either an "H" or a "D" value to indicate "Hours" or "Days". I want to display "Hours" or "Days" in the header based on the dataRow field value.
Is there a way to determine the value of the dataRow field when the gridview is processing the Header row?
if (e.Row.RowType == DataControlRowType.Header)
{
if (e.Row.Cells[2].Text.Conta ins("H")) This is the datarow field value I'm trying to access (this doesn't work)
Is there a way to determine the value of the dataRow field when the gridview is processing the Header row?
if (e.Row.RowType == DataControlRowType.Header)
{
if (e.Row.Cells[2].Text.Conta
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
2. Then, assuming all no row can have an "H" when another row contains a "D", look at the first row
3. If the first row has an "H" change the gridview header row column
4. Do the same if the row has a "D"