复制代码 代码如下:
ul, li
{
margin: 0;
padding: 0;
}
#scrollDiv1
{
width: 300px;
height: 25px;
line-height: 25px;
border: #ccc 0px solid;
overflow: hidden;
}
#scrollDiv1 li
{
height: 25px;
padding-left: 10px;
}
#scrollDiv2
{
width: 300px;
height: 25px;
line-height: 25px;
border: #ccc 0px solid;
overflow: hidden;
}
#scrollDiv2 li
{
height: 25px;
padding-left: 10px;
}
<%--头部部分--%>
| | |||
|
<%--头部部分结束--%>
后台Util/MainUtil.aspx.cs输出对应的 HTML 的数据
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace Web.Util
{
public partial class MainUtil : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
int k = int.Parse(Request["param"].ToString());
switch (k)
{
case 1:
toOne();
break;
case 2:
toTwo();
break;
default:
break;
}
}
catch { }
}
private void toOne()
{
try
{
string st = String.Empty;
string companyName = Request["nameparam"].ToString();
DataTable dt1 = DBUtility.DbHelperSQL.Query("select top(5) Title,Id from 公告表 where TypeId='2' And Creater='" + companyName + "'order by CreatTime desc").Tables[0];
for (int i = 0; i < dt1.Rows.Count; i++)
{
//把公告做成超链接
st += "
}
showHtml(st);
}
catch { }
}
private void toTwo()
{
try
{
string st = String.Empty;
string companyName= Request["nameparam"].ToString();
DataTable dt2= DBUtility.DbHelperSQL.Query("select top(5) Title,Id from 公告表 where Id IN (select top 10 Id from 公告表 where TypeId='2' And Creater='"+companyName+"'order by CreatTime desc) order by CreatTime asc").Tables[0];
//把公告做成超链接
for (int i = 0; i < dt2.Rows.Count; i++)
{
st += "
}
showHtml(st);
}
catch { }
}
private void showHtml(string st){
Response.ContentType = "text/html";//text/html,和application/json 都是输出格式
Response.Write(st);
Response.Flush();
Response.Close();
}
}
}



