for (int i = Repeater2.Items.Count - 1; i > 0; i--)
{
HtmlTableCell oCell_previous = Repeater2.Items[i - 1].FindControl("f_Type") as HtmlTableCell;
HtmlTableCell oCell = Repeater2.Items[i].FindControl("f_Type") as HtmlTableCell;
oCell.RowSpan = (oCell.RowSpan == -1) ? 1 : oCell.RowSpan;
oCell_previous.RowSpan = (oCell_previous.RowSpan == -1) ? 1 : oCell_previous.RowSpan;
if (oCell.InnerText == oCell_previous.InnerText)
{
oCell.Visible = false;
oCell_previous.RowSpan += oCell.RowSpan;
}
}
提示这行错误:
System.NullReferenceException: 未将对象引用设置到对象的实例。
解决办法:<td>里要写runat="server"