Asp.net网页中数据的排版

Asp.net网页中数据的排版,第1张

内容在入库之前,需要格式化一下

string str = "你要存入数据库的内容"

str = HttpUtility.HtmlEncode(str)

str = str.Replace("\n", "<br/>")

<%

Set Rs = server.createobject("adodb.recordset")

Rs.source = "SELECT * FROM Products where LPutout=true ORDER BY id DESC"

Rs.open Rs.source,conn,1,1

Response.Write"<table width='99%' border='0' cellspacing='0' cellpadding='0' class='Index-Center4'>"

if Rs.BOF then

response.write "<tr><td align='center'>暂无产品信息!</td></tr>"

else

Response.Write"<tr>"

i=0

do while not rs.eof

Response.Write"<td width='25%'>"

'=========

set RsTrue = server.createobject("adodb.recordset")

RsTrue.open "select GroupLevel from Nweb_UGroup where GroupID='"&Rs("GroupID")&"'",conn,1,1

GroupLevel=RsTrue("GroupLevel")

RsTrue.Close

set RsTrue=nothing

if Session("GroupLevel")="" then Session("GroupLevel")=0

LPattern=Rs("LPattern")

Select Case Rs("Exclusive")

Case "<"

if Session("GroupLevel") <GroupLevel then

LPattern="Images/NoRight.gif"

end if

Case "="

if Session("GroupLevel") <>GroupLevel then

LPattern="Images/NoRight.gif"

end if

End Select

'=========

LName=Rs("LName")

if len(LName)>10 then LName=left(LName,10)&"…"

Response.Write"<table align=center border='0' cellpadding='0' cellspacing='0' ><tr><td align='center' width='142' height='142' style='text-decoration: underlineborder: 1px solid #CCCCCC'><a href='ProductsView.asp?id="&Rs("id")&"' target='_blank'><img src="&LPattern&" border=0 width=140 height=140 onload=javascript:DrawImage(this)></a></td></tr><tr><td height=28><img src=Images/Arrow-Index-Products.gif width=14 height=12 align=absmiddle><a href='Products.asp?id="&Rs("id")&"' target='_blank'>"&LName&"</a></td></tr></table>"

response.Write"</td>"

i=i+1

if i mod 4= 0 then

response.Write"</tr>"

end if

Rs.movenext

next

end if

Response.Write"</tr>"

Response.Write"</table>"

Rs.Close

set Rs=nothing

%>

中间的那段代码没有去分析,如果没有问题的话 应该可以直接使用


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/6750072.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-27
下一篇 2023-03-27

发表评论

登录后才能评论

评论列表(0条)

保存