string getHtml() { StringBuilder Html = new StringBuilder(); DataSet ds = Affiche.GetAllAffiches(); if (ds != null) { int Count = ds.Tables[0].Rows.Count; int Nbr = 0; if (Count > 13) { Nbr = 13; } else { Nbr = Count; } Html.Append("<TABLE rules=\"rows\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" align=\"center\" border=\"0\" class=\"Flowtable\">"); for (int i = 0; i < Nbr; i++) { DataRow Row = ds.Tables[0].Rows[i]; string title = Row["Title"].ToString(); string flag = Row["TypeNbr"].ToString(); string guid = Row["Guid"].ToString(); Html.Append("<TR>"); Html.Append("<TD height=\"20\" width=\"5%\" class=\"SystemDashedTd\" vAlign=\"middle\"><IMG src=\"Images/down/ImWorkSmall.gif\">"); Html.Append("</TD>"); if (flag == "0") { Html.Append("<TD height=\"20\" width=\"95%\" class=\"SystemDashedTd\" vAlign=\"center\" align=\"left\" style=\"PADDING-TOP: 4px\" nowrap=\"false\"><font style=\"COLOR: #94939B\">通告:" + title.Trim() + "</font>"); } else { Html.Append("<TD height=\"20\" width=\"95%\" class=\"SystemDashedTd\" vAlign=\"center\" align=\"left\" style=\"PADDING-TOP: 4px\" nowrap=\"false\"><font style=\"COLOR: #94939B\">发文:</font><A title=\"" + title.Trim() + "\" target=\"_blank\" href=\"SiteBll/SysMan/AfficheView.aspx?GUID=" + guid + "\">" + title.Trim() + "</A>"); } Html.Append("</TD>"); Html.Append("</TR>"); } if (Count > 13) { Html.Append("<TR>"); Html.Append("<td colspan=\"2\" height=\"5\" width=\"100%\">"); Html.Append("</td>"); Html.Append("</TR>"); Html.Append("<TR>"); Html.Append("<td colspan=\"2\" vAlign=\"middle\" align=\"right\" width=\"100%\"><A href=\"SiteBll/SysMan/AfficheList.aspx\" target=\"frm\"><IMG src=\"Images/icon/More.gif\" border=\"0\"></A>"); Html.Append("</td>"); Html.Append("</TR>"); } else { Html.Append("<TR>"); Html.Append("<td colspan=\"2\" height=\"5\" width=\"100%\">"); Html.Append("</td>"); Html.Append("</TR>"); } Html.Append("</TABLE>"); } return(Html.ToString()); }
private void BindGrid() { try { DataSet ds = Affiche.GetAllAffiches(); this.grdAffList.DataSource = ds; this.grdAffList.DataBind(); } catch { this.PrintfError("系统错误!"); } }