hide repeating data
-
table data is
col1 col2 col3 col4
1 1a 1b 1c
1 1a 1d 1e
1 1b 1f 1g
2 2a 2b 2c
2 2a 2d 2e
2 2b 2f 2g
2 2b 2h 2i
2 2b 2j 2kNeed to format output as
col1 col2 col3 col4
1 1a 1b 1c
1d 1e
1b 1f 1g
2 2a 2b 2c
2d 2e
2b 2f 2g
2h 2i
2j 2ki.e hiding repeating data. I am thinking creating a data table object then check for repeating data column, if repeat then add blank column, else add same column. Is there any other way of achieving this ? what if table contain 10000 rows ? Any logic/help/link/post will be much helpful. regards
-
table data is
col1 col2 col3 col4
1 1a 1b 1c
1 1a 1d 1e
1 1b 1f 1g
2 2a 2b 2c
2 2a 2d 2e
2 2b 2f 2g
2 2b 2h 2i
2 2b 2j 2kNeed to format output as
col1 col2 col3 col4
1 1a 1b 1c
1d 1e
1b 1f 1g
2 2a 2b 2c
2d 2e
2b 2f 2g
2h 2i
2j 2ki.e hiding repeating data. I am thinking creating a data table object then check for repeating data column, if repeat then add blank column, else add same column. Is there any other way of achieving this ? what if table contain 10000 rows ? Any logic/help/link/post will be much helpful. regards
hi, You cant hide repeating data, best you can do is represent data as group. You will find many cool js grid that represent grouped data. You can also look at these articles http://www.aspcode.net/ASPNET-grouping-repeater-control.aspx[^] A Grouping Repeater Control for ASP.NET[^] http://mattberseth.com/blog/2008/01/building_a_grouping_grid_with.html[^]
-
table data is
col1 col2 col3 col4
1 1a 1b 1c
1 1a 1d 1e
1 1b 1f 1g
2 2a 2b 2c
2 2a 2d 2e
2 2b 2f 2g
2 2b 2h 2i
2 2b 2j 2kNeed to format output as
col1 col2 col3 col4
1 1a 1b 1c
1d 1e
1b 1f 1g
2 2a 2b 2c
2d 2e
2b 2f 2g
2h 2i
2j 2ki.e hiding repeating data. I am thinking creating a data table object then check for repeating data column, if repeat then add blank column, else add same column. Is there any other way of achieving this ? what if table contain 10000 rows ? Any logic/help/link/post will be much helpful. regards
You can look into
MergeRows
function in this article: Pivoting DataTable Simplified[^] This should give a fair idea on merging rows here.
Anurag Gandhi.
http://www.gandhisoft.com
Life is a computer program and every one is the programmer of his own life.
My latest article: Group GridView Data -
table data is
col1 col2 col3 col4
1 1a 1b 1c
1 1a 1d 1e
1 1b 1f 1g
2 2a 2b 2c
2 2a 2d 2e
2 2b 2f 2g
2 2b 2h 2i
2 2b 2j 2kNeed to format output as
col1 col2 col3 col4
1 1a 1b 1c
1d 1e
1b 1f 1g
2 2a 2b 2c
2d 2e
2b 2f 2g
2h 2i
2j 2ki.e hiding repeating data. I am thinking creating a data table object then check for repeating data column, if repeat then add blank column, else add same column. Is there any other way of achieving this ? what if table contain 10000 rows ? Any logic/help/link/post will be much helpful. regards
hi, You can use a List collection to store the data whilst reading from the db. i don't know where you are getting the data from or how so i will assume its from the database and u are using TSQL
/// Your sql reader
SqlDataReader = reader.ExecuteQuery ( commandText ) ;
/// Your list
ArrayList aList = new ArrayList ( ) ;
while ( reader.Read ( ))
{
if ( ! aList.Contains ( ( string )reader[ "rowname" ] ) )
{
/// Add the row to table
}
/// else, oh snap! skip me already been added}
Good luck