|
主题: ASP.NET里数据集的字段如何自动换行
|
测试
职务:普通成员
等级:1
金币:0.0
发贴:116
|
#12004/3/6 4:36:28
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT> function DoWhiteSpace(str) DoWhiteSpace = Replace((Replace(str, vbCrlf, "<br>")), chr(32)&chr(32), " ") End Function </SCRIPT>
<%# DataSet1.Fieldvalue("字段", Container) %> 这个DoWhiteSpace应该加在哪里?
|
测试
职务:普通成员
等级:1
金币:0.0
发贴:116
|
#22004/3/7 9:16:56
源错误:
行 66: <td width="567"> 行 67: 行 68: <%# DoWhiteSpace(DataSet1.Fieldvalue("Interpretation", Container)) %> </td> 行 69: </tr> 行 70: </table></td>
|
测试
职务:普通成员
等级:1
金币:0.0
发贴:116
|
#32004/3/8 7:09:10
还是不行,晕啊
|
测试
职务:普通成员
等级:1
金币:0.0
发贴:116
|
#42004/3/8 7:37:08
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %> <%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %> <MM:DataSet id="DataSet1" runat="Server" IsStoredProcedure="false" ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_hacker"] %>' DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_hacker"] %>' CommandText='<%# "SELECT * FROM mdb.rj WHERE Category = @Category ORDER BY hiddenField DESC" %>' CurrentPage='<%# ((Request.QueryString["DataSet1_CurrentPage"] != null) && (Request.QueryString["DataSet1_CurrentPage"].Length > 0)) ? Int32.Parse(Request.QueryString["DataSet1_CurrentPage"]) : 0 %>' PageSize="10" FailureURL='<%# "http://www.***.com" %>' Debug="true" > <Parameters> <Parameter Name="@Category" value='<%# "软件" %>' Type="NChar" /> </Parameters> </MM:DataSet> <MM:pageBind runat="server" PostBackBind="true" /> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>测试</title> <link href="../CSS/HACSS.css" rel="stylesheet" type="text/css"> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table width="680" border="0" cellspacing="0" cellpadding="5"> <tr> <td><ASP:Repeater runat="server" DataSource='<%# DataSet1.DefaultView %>'> <ItemTemplate> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#319ACE" class="HACKER"> <tr> <td class="319ACE"> <table width="680" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="340" class="white1"> <a href="<%# DataSet1.Fieldvalue("Download Address", Container) %>" class="white1"> <%# DataSet1.Fieldvalue("Name", Container) %> </a> </td> <td width="113"> <div align="center" class="yellow"> <%# DataSet1.Fieldvalue("Category", Container) %> </div></td> <td width="113"> <div align="left" class="white"> <%# DataSet1.Fieldvalue("category2", Container) %> </div></td> <td width="114"> </td> </tr> </table></td> </tr> <tr> <td><table width="680" border="0" cellspacing="0" cellpadding="0"> <tr class="to2"> <td width="113"> <div align="center">更新日期</div></td> <td width="226" class="red"> <%# DataSet1.Fieldvalue("hiddenField", Container) %> </td> <td width="113"> <div align="center">推荐程度</div></td> <td width="228"><img src="Images/PIC/<%# DataSet1.Fieldvalue("xing", Container) %>" width="55" height="12"> </td> </tr> </table></td> </tr> <tr> <td class="to3"> <table width="680" border="0" cellspacing="0" cellpadding="0"> <tr class="to3"> <td width="113"> <div align="center">介绍</div></td> <td width="567"> <%# DataSet1.Fieldvalue("Interpretation", Container) %> </td> </tr> </table></td> </tr> </table></td> </tr> </table> </ItemTemplate> </ASP:Repeater></td> </tr> </table> <table width="50%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class="HACKER"> <td width="23%" align="center"> <div align="center"> <MM:If runat="server" Expression='<%# (DataSet1.CurrentPage != 0) %>'> <ContentsTemplate> <a href="<%# Request.ServerVariables["../SCRIPT_NAME"] %>?DataSet1_currentPage=0"><img src="../Images/First.gif" border=0></a> </ContentsTemplate> </MM:If> </div></td> <td width="31%" align="center"> <div align="center"> <MM:If runat="server" Expression='<%# (DataSet1.CurrentPage != 0) %>'> <ContentsTemplate> <a href="../<%# Request.ServerVariables["SCRIPT_NAME"] %>?DataSet1_currentPage=<%# DataSet1.CurrentPage - 1 %>"><img src="../Images/Previous.gif" border=0></a> </ContentsTemplate> </MM:If> </div></td> <td width="23%" align="center"> <div align="center"> <MM:If runat="server" Expression='<%# (DataSet1.CurrentPage < DataSet1.LastPage) %>'> <ContentsTemplate> <a href="../<%# Request.ServerVariables["SCRIPT_NAME"] %>?DataSet1_currentPage=<%# DataSet1.CurrentPage + 1 %>"><img src="../Images/Next.gif" border=0></a> </ContentsTemplate> </MM:If> </div></td> <td width="23%" align="center"> <div align="center"> <MM:If runat="server" Expression='<%# (DataSet1.CurrentPage < DataSet1.LastPage) %>'> <ContentsTemplate> <a href="../<%# Request.ServerVariables["SCRIPT_NAME"] %>?DataSet1_currentPage=<%# DataSet1.LastPage %>"><img src="../Images/Last.gif" border=0></a> </ContentsTemplate> </MM:If> </div></td> </tr> </table>
<p class="HACKER">记录 <%= (DataSet1.RecordCount == 0) ? 0 : (DataSet1.StartRecord + 1) %> 到 <%= DataSet1.EndRecord %> (总共 <%= DataSet1.RecordCount %> 个记录) </p> </body> </html>
想让他自动换行,但不知道怎么写 <SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT> function DoWhiteSpace(str) DoWhiteSpace = Replace((Replace(str, vbCrlf, "<br>")), chr(32)&chr(32), " ") End Function </SCRIPT>
<%# DataSet1.Fieldvalue("Interpretation", Container) %> 这个DoWhiteSpace应该加在哪里?
|
测试
职务:普通成员
等级:1
金币:0.0
发贴:116
|
#52004/3/8 13:03:33
不是在.NET中用<%= DoWhiteSpace(rj.Fields.Item("Interpretation").value)%>可以实现,在.NET中如何调用
|