选项 1"
您可以构建一个表格格式的 html 字符串并将其绑定到网格。在后面的代码中执行此操作。
sb.Append("<table style=\"width: 100%;\"> ");
for (int i = 0; i < cnt;i++)
{
col1="";
col2="";
col3="";
String fmt= @"<tr>
<td style='width: 33%;' >
<b>{0}</b>
</td>
<td style='width: 33%;'>
{1}
</td>
<td style='width: 33%;' >
{2}
</td>
</tr>";
col1 = row[i].col1 ;
col2 = row[i].col2 ;
col3 = row[i].col3 ;
sb.AppendFormat(fmt, col1,col2,col3);
}
sb.Append("</table>");
选项2:(
或者您可以在aspx页面的gridview中使用表格格式)
<ItemTemplate>
<div class="innerTable">
<table>
<tr >
<td ></td>
<td ></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</div>
</ItemTemplate>