您的位置:首页 > 其它

前台用Table控件显示重复数据的类

2005-04-27 19:49 561 查看
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using dataManagerForEC;
using System.Data;
using System.Data.SqlClient;

namespace ec
{
/// <summary>
/// tableDraw 的摘要说明。
/// </summary>
public class tableDraw
{
public tableDraw()
{
//
// TODO: 在此处添加构造函数逻辑
//
}

static public void drawDoubleCol(dataManager dm,DataSet ds,Table table,int rowNum,string imgPath,string tableName,string colLink,string colName,string colOrder,string linkWebPage)
{
table.BorderWidth=0;
table.CellPadding=0;
table.CellSpacing=0;

string sqlSelect="select top "+rowNum.ToString()+" "+colLink+","+colName+" from "+tableName+" order by "+colOrder+" desc";
dm.SelectData(ds,sqlSelect,tableName);

for(int i=0;i<ds.Tables[tableName].Rows.Count;i++)
{
TableRow tRow=new TableRow();
table.Rows.Add(tRow);

TableCell tCell=new TableCell();
tCell.Width=20;
tCell.HorizontalAlign=HorizontalAlign.Center;
tCell.Text="<img src='"+imgPath+"'>";
tRow.Cells.Add(tCell);

TableCell tCell2=new TableCell();
//tCell2.Width=int.Parse(table.Width.ToString())-int.Parse(tCell.Width.ToString());
tCell2.Text="<a href="+linkWebPage+"?id="+ds.Tables[tableName].Rows[i][colLink].ToString()+" target='_blank'>"+ds.Tables[tableName].Rows[i][colName].ToString()+"</a>";
tRow.Cells.Add(tCell2);
}

ds.Tables[tableName].Clear();

}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐