Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
asp.net c#使用sql标记,innertext不使用新行_C#_Asp.net_Html_Sql Server 2008_Marquee - Fatal编程技术网

asp.net c#使用sql标记,innertext不使用新行

asp.net c#使用sql标记,innertext不使用新行,c#,asp.net,html,sql-server-2008,marquee,C#,Asp.net,Html,Sql Server 2008,Marquee,我是编程领域的新手……所以请给出正确的答案 我使用动态字幕和sql数据库的“公司新闻”,有代码运行正常,但字幕不创建新行的新点 html代码: <asp:Panel ID="Panel1" runat="server" CssClass="style42" Width="762px" BorderStyle="Solid" Font-Bold="True" Font-Size="Medium" BackColor="#78BBE6" Height="267px">

我是编程领域的新手……所以请给出正确的答案

我使用动态字幕和sql数据库的“公司新闻”,有代码运行正常,但字幕不创建新行的新点

html代码:

<asp:Panel ID="Panel1" runat="server" CssClass="style42" Width="762px" 
    BorderStyle="Solid" Font-Bold="True" Font-Size="Medium" BackColor="#78BBE6" 
    Height="267px">
    <div style="width: 762px; " class="style41">
       <marquee id="mar1" runat="server" direction="up" onmouseover="this.stop()" 
                onmouseout="this.start()" scrollamount="2" scrolldelay="1" 
                class="style43" >
            <strong>
            </strong>
       </marquee>   
    </div>
</asp:Panel>
在我的数据库中只有一个字段用于输入新闻内容。。。 当使用文本框显示新闻时,效果很好。它在新行中显示新点。但选框不能像文本框那样显示


请给我适当的建议….

在文本框中输入换行符会在C#中产生换行符(
\n
)。HTML忽略换行符,要在HTML中强制换行,必须使用

标记:

this.mar1.InnerHtml= t1[6].ToString().Replace("\n", "<br />");
this.mar1.InnerHtml=t1[6].ToString().Replace(“\n”,“
”);
您需要更改此行

 this.mar1.InnerHtml= t1[6].ToString();  
       //what to do for newpoint in newline     

this.mar1.InnerHtml+=t1[6].ToString()+“
”; //在换行符中为newpoint执行什么操作
或者你的单条记录中有新行字符,那么你应该这样做

this.mar1.InnerHtml+= t1[6].ToString().Replace("\n", "<br />");
this.mar1.InnerHtml+=t1[6].ToString().Replace(“\n”,“
”);
你想让你的下一条新闻排在第一条新闻之后吗?我强烈建议避免使用
标签-它并没有得到一致的支持。看看这个问题及其公认的答案:
 this.mar1.InnerHtml+= t1[6].ToString()+"<br/>";  
       //what to do for newpoint in newline     
this.mar1.InnerHtml+= t1[6].ToString().Replace("\n", "<br />");