您的位置:首页 > 编程语言 > ASP

[原创] asp.net生成HTML的合并table行列rowspan的新方法

2010-04-08 11:40 771 查看
相信你也遇到过这样的一个合并table的情况,如截图:

代码

/// <summary>
/// 在输入框的情况下,判断定编是否初始化
///     已初始化 - 显示定编
///     未初始化 - 显示"--"
/// </summary>
/// <param name="inCount"></param>
/// <param name="settingJobCount"></param>
/// <returns></returns>
public string GetJobCountForLabel(int inCount, string settingJobCount)
{
string _result = string.Empty;

if (inCount == 0)
{
_result = "--";
}else if (inCount == 1)
{
_result = settingJobCount;
}
return _result;
}

#region 编制报表合并表格公共方法
/// <summary>
/// 统计rowspan值
/// 如果减1后为0,则如果下一行还有数据就显示带有rowspan的行
/// </summary>
/// <param name="rowspanListCount"></param>
/// <returns></returns>
public void SetRowspanListCountSubtraction(ref int[] rowspanListCount, ref bool[] rowspanListShow)
{
for (int i = 0; i < rowspanListCount.Length; i++)
{
// 统计rowspan值
rowspanListCount[i] = rowspanListCount[i] - 1;

// 如果减1后为0,则如果下一行还有数据就显示带有rowspan的行
if (rowspanListCount[i] == 0)
{
// 下行显示
rowspanListShow[i] = true;
}
else
{
// 下行不显示
rowspanListShow[i] = false;
}
}
}

/// <summary>
/// 置rowspan赋值为0
/// </summary>
/// <param name="rowspanListCount"></param>
/// <returns></returns>
public void InitRowspanListCount(ref int[] rowspanListCount)
{
for (int i = 0; i < rowspanListCount.Length; i++)
{
// 统计rowspan值
rowspanListCount[i] = 0;
}
}

/// <summary>
/// 置控制是否显示带rowspan的行为true
/// </summary>
/// <returns></returns>
public void InitRowspanListShow(ref bool[] rowspanListShow)
{
for (int i = 0; i < rowspanListShow.Length; i++)
{
// 统计rowspan值
rowspanListShow[i] = true;
}
}
#endregion
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: