"ShiroiRyuu" <ro***************@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
tenho um dataset que tem um numero de colunas variavel que é
apresentado num grid view e eu queria podsr agrupar alguns headers
desse gridview quando as colunas possuirem o mesmo nome. por exemplo
é assim:
empresa | teste | teste | campo | alfa | alfa
---------------------------------------------------------------------------*-------
nome | 134 | 214 | 342 | 245 | 456
nome | 100 | 344 | 453 | 312 | 78
e eu quero que fique assim:
empresa | teste | beta | alfa
---------------------------------------------------------------------------*-------
nome | 134 | 214 | 342 | 245 | 456
nome | 100 | 344 | 453 | 312 | 78
alguem sabe como fazer isso?
obrigado!
This might help a little. It dynamically builds the header text of a
gridview based on drop down list values:
(you can run it at:
http://monte.jodoshared.com/FindAnItem.aspx (the
'Compare' page does this dynamic header manipulation))
protected void GridViewCompareSet_Sorting(object sender,
GridViewSortEventArgs e)
{
DataTable m_DataTable = (DataTable)Session["dtFinal"];
if (m_DataTable != null)
{
int m_PageIndex = GridViewCompareSet.PageIndex;
string m_SortDirection = GetSortDirection();
DataView m_DataView = new DataView(m_DataTable);
m_DataView.Sort = e.SortExpression + " " + m_SortDirection;
GridViewCompareSet.DataSource = m_DataView;
GridViewCompareSet.DataBind();
GridViewCompareSet.HeaderRow.Cells[1].Text =
DropDownList1.SelectedItem.ToString();
GridViewCompareSet.HeaderRow.Cells[2].Text =
DropDownList2.SelectedItem.ToString();
GridViewCompareSet.HeaderRow.Cells[0].Width = 100;
GridViewCompareSet.HeaderRow.Cells[1].Width = 90;
GridViewCompareSet.HeaderRow.Cells[2].Width = 90;
GridViewCompareSet.PageIndex = m_PageIndex;
}
}