When I go through the event RowDataBound
of a GridView
, I want to get the value of headertext
of the column but I can not.
An example I want to get:
if (e.Row.RowType.ToString().Equals("Header"))
{
}
else if (e.Row.RowType == DataControlRowType.DataRow)
{
int tot = e.Row.Cells.Count;
for (int i = 1; i < tot; i++)
{
TextBox txtValor = new TextBox();
txtValor.Width = 15;
string produ = e.Row.Header.text //Preciso de obter o valor do titulo da coluna.
txtValor.Text = (e.Row.DataItem as DataRowView).Row[produ].ToString();
e.Row.Cells[i].Controls.Add(txtValor);
}
}