This may be caused by typographical layout. Some programs published in the ASP. NET gridview dataset on msdn in the group row section include batch layout,
Specifically, this list is used to list the correct program category (mainly the generic category data of the generic list) <,> operator, may have been missed during formatting ).
Group row program running |
Private void preparegroup () { Int lastsupid =-1; Gridviewrow currentrow = NULL; List <gridviewrow> Tempmodifyrows = new list <gridviewrow> (); Foreach (gridviewrow row in gridview1.rows) { If (row. rowtype = datacontrolrowtype. datarow) { If (currentrow = NULL) { Currentrow = row; Int. tryparse (row. cells [2]. Text, out lastsupid ); Continue; } Int currsupid =-1; If (Int. tryparse (row. cells [2]. Text, out currsupid )) { If (lastsupid! = Currsupid) { Currentrow. cells [2]. attributes ["rowspan"] = (tempmodifyrows. Count + 1). tostring (); Currentrow. cells [2]. attributes ["valign"] = "center "; Foreach (gridviewrow row2 in tempmodifyrows) Row2.cells. removeat (2 ); Lastsupid = currsupid; Tempmodifyrows. Clear (); Currentrow = row; Lastsupid = currsupid; } Else Tempmodifyrows. Add (ROW ); } } } If (tempmodifyrows. Count> 0) { Currentrow. cells [2]. attributes ["rowspan"] = (tempmodifyrows. Count + 1). tostring (); Currentrow. cells [2]. attributes ["valign"] = "center "; Foreach (gridviewrow row2 in tempmodifyrows) Row2.cells. removeat (2 ); } } Protected void gridviewincluprerender (Object sender, eventargs E) { Preparegroup (); } |
Sorry for the problem that caused everyone else.