473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

gridview headers

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!

Dec 1 '06 #1
1 2915

"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;

}

}


Dec 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hans Merkl | last post by:
Hi, Is there a way to show the column headers of a GridView control even if there is no data? The only thing I see is the EmptyDataTemplate but I would also like to display the column headers. ...
3
by: Joseph Gordon | last post by:
I need to "freeze" the headers for a webforms gridview. I have found no documentation or articles that explain how to accomplish this using the ASP.NET 2.0 GridView control. I really prefer not...
1
by: RS | last post by:
I am using gridview in my web application. I have also implemented sorting and paging. I problem is when I scroll the gridview, the header also scrolls with it. How can I make the gridview headers...
1
by: syl | last post by:
Hello I am trying to create a "easy to use" gridview with filters (dropdownlist in headers), sorting...and much more.... In order to do that, i prefer to use a objectdatasource (ODS) beacause...
1
by: jmdolinger | last post by:
Hi all, I'm a newbie to Atlas (and recently ASP.NET) after coming from a long Java background, also have done quite a bit with an Ajax.NET/ASP.NET 1.1 project, but it was basically all...
2
by: cartmann | last post by:
Hi, I have a gridview with a template column. In the template column i have two commandbuttons. When clicking the buttons I enter the cmd_click event - but how do I read in which row the button...
4
by: wardemon | last post by:
Hi All, I was wondering how to display headers of a gridview on the left, instead of on top (default). Thanks, Henry
4
by: Tomasz | last post by:
Hello Developers, Here is interesting problem I just came across: how do I wire a GridView control programmatically? Here is my sample code using Object Data Source: protected void...
1
by: COHENMARVIN | last post by:
Is there any way to allow the user to see the titles of the columns of his gridview as he scrolls down the page? If I have a grid view with 50 rows, the top titles are no longer in view and its...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.