I am less lazy about controls. There are a few controls I prefer to use, such as repeater display list of controls, can provide great convenience.
The use of repeater has a more convenient function is through a few lines of code to achieve the same merge cell merge, although the usual less use, but sometimes customers or managers compared tricky time, it is really good to feel this!
When I use Ajax to achieve an effect today, the Repeater list control won't come in handy, so I have to find a way to implement cell merging of the same table items according to some rules of HTML.
Toss, finally calculate the effect achieved. Here's the memo.
Erp_reports reprots =NewErp_reports (); DataTable DTXSSJFX= Reprots. GETXSSJFX_DX (Txtsdate.text, Txtedate.text);//Get Sales Data analysis report if(DtXSSJFX.Rows.Count >0) {StringBuilder sb=NewStringBuilder (); intRowsindex =1; for(inti =0; i < DtXSSJFX.Rows.Count; i++) { if((i +1) !=dtXSSJFX.Rows.Count) {if(dtxssjfx.rows[i]["DLMC"]. ToString () = = Dtxssjfx.rows[i +1]["DLMC"]. ToString ()) {Rowsindex++; } Else{sb. Appendline ("<tr style=\ "line-height:24px\" onmouseout=\ "this.style.backgroundcolor=backupcolor\" onmouseover=\ " this.backupcolor=this.style.backgroundcolor;this.style.backgroundcolor= ' #F1F6FF ' \ ' >"); Sb. AppendFormat ("<td rowspan=\ "{0}\" style=\ "text-align:left; width:100px; \" >{1}</td>", Rowsindex, dtxssjfx.rows[i]["DLMC"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["JJMC"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["SL_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["JE_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["ZB_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["Sl_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["Je_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["Zb_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["SL_HJ"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["JE_HJ"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-rowsindex]["ZB_HJ"]. ToString ()); Sb. Appendline ("</tr>"); for(intj =1; J < Rowsindex; J + +) {sb. Appendline ("<tr style=\ "line-height:24px\" onmouseout=\ "this.style.backgroundcolor=backupcolor\" onmouseover=\ " this.backupcolor=this.style.backgroundcolor;this.style.backgroundcolor= ' #F1F6FF ' \ ' >"); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["JJMC"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["SL_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["JE_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["ZB_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["Sl_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["Je_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["Zb_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["SL_HJ"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["JE_HJ"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[i +1-Rowsindex + j]["ZB_HJ"]. ToString ()); Sb. Appendline ("</tr>"); } Rowsindex=1; } } Else{sb. Appendline ("<tr style=\ "line-height:24px\" onmouseout=\ "this.style.backgroundcolor=backupcolor\" onmouseover=\ " this.backupcolor=this.style.backgroundcolor;this.style.backgroundcolor= ' #F1F6FF ' \ ' >"); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["DLMC"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["JJMC"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["SL_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["JE_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["ZB_JM"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["Sl_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["Je_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["Zb_zy"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["SL_HJ"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["JE_HJ"]. ToString ()); Sb. AppendFormat ("<td style=\ "text-align:left; width:100px; \" >{0}</td>", Dtxssjfx.rows[dtxssjfx.rows.count-1]["ZB_HJ"]. ToString ()); Sb. Appendline ("</tr>"); }} Lithtmls.text= sb. ToString ();
Asp. net-merge HTML table with same item cell