c# - 向框中添加换行符

标签 c# javascript asp.net

我弹出了一个 JavaScript 框,其中包含一些消息,但我还没有找到如何从后面的代码添加换行符,我被要求这样做,这是它目前的工作原理:

 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "key", 
"function SendBox() {location.href = 'movetopage.aspx';}
 if(confirm('Move the items:" + myListOfItems + ". Do you want to continue? ') == true)
 {SendBox();};", true);

页面上显示正常,但现在我需要添加以下行

"Clicking OK:  Moves the items and continues"

所以最终的bos应该像这样显示

Move the items: Books, Magazines, Newspapers. Do you want to continue?

Cliking OK: Moves the items and continues.

注意到第一行和第二行之间的中断吗?,鉴于我为 Page.ClientScript 提供的代码...等,我不知道如何将其添加到框中。

如何将断线添加到弹出框中?

 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "key", 
"function SendBox() {location.href = 'movetopage.aspx';}
 if(confirm('Move the items:" + myListOfItems + ". Do you want to continue? 
<BR> 
 Clicking OK: Moves the items and continues') == true)
 {SendBox();};", true);

我尝试添加一个休息
但不起作用(有道理),但我已经用尽了选择。

最佳答案

使用\n而不是<br/>因为它不是 htmt,根据您的情况,您应该使用 \\n因为在 c# 中 \应该是转义

关于c# - 向框中添加换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10221414/

相关文章:

asp.net - 添加到 Response.Cookies 的 Cookie 也添加到 Request.Cookies。有什么办法可以得到原始的Request.Cookies?

asp.net - AjaxFileUpload : How can I alert the user to a server-side error in OnUploadComplete?

c# - ML.NET 图像分类迁移学习可以从保存的模型 .zip 文件或检查点恢复吗?如何?

c# - 读取 XML 节点时出现问题

javascript - 如何使用多个变量来创建多个jquery选择器?

javascript - 如何区分方法和函数?

asp.net - 哪个版本的 ASP.NET 支持使用 Windows AppFabric 缓存进行 session 管理

c# - 有什么方法可以匹配 Visual Fox Pro 和 C#.Net 的 RAND(INT) 方法

c# - Linq 包括集合中的子项

javascript - 如何处理 promise 的错误?