简体   繁体   中英

How to Merge Gridview Row with same value in Asp.net C#

i have gridview column below

row1  |  row1  |  row1  | row1
row2  |  row2  |  row2  | row2
Total |  Total |  Total | Total2
row4  |  row4  |  row4  | row4
row5  |  row5  |  row5  | row5
row6  |  row6  |  row6  | row6
row7  |  row7  |  row7  | row7
Total |  Total |  Total | Total4

and i want merge gridview rows, below is the output:

row1  |  row1  |  row1  | row1
row2  |  row2  |  row2  | row2
                  Total | Total2
row4  |  row4  |  row4  | row4
row5  |  row5  |  row5  | row5
row6  |  row6  |  row6  | row6
row7  |  row7  |  row7  | row7
                  Total | Total4

how can to merge gridview rows like above, i want to give color every Total row

I would suggest you use the gridview RowDataBound event.

At first setup the GV with the appropriate controls then populate the GV with your data and assign the controls with values from your object.

Start with http://www.dotnetgallery.com/kb/resource17-RowDatabound-event-tips-and-tricks-in-Gridview-control.aspx.aspx

and

http://www.dotnetlearners.com/blogs/view/120/Aspnet-GridView-RowDataBound-example-using-C-.aspx

to get you heading towards the right direction

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM