Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.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
C# c中弹出框中的新行#_C#_Asp.net - Fatal编程技术网

C# c中弹出框中的新行#

C# c中弹出框中的新行#,c#,asp.net,C#,Asp.net,单击GridView的行后,我将使用下面的代码生成弹出窗口 string ky = "Hello World" //ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('This is alert Message from C#')", true); ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup

单击GridView的行后,我将使用下面的代码生成弹出窗口

string ky = "Hello World"
        //ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('This is alert Message from C#')", true);
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('"+ky+"')", true);
它工作得很好

当我插入新行字符时,它不起作用

string ky = "Hello \nWorld"
        //ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('This is alert Message from C#')", true);
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('"+ky+"')", true);
我想把它看作

你好

世界

还有没有办法设计弹出框。

一个小错误

string ky = "Hello \nWorld"
只需在“Hello\nWorld”之前加上@,这是一个小错误

string ky = "Hello \nWorld"
只需在“Hello\nWorld”之前加上@

将字符串改为

string ky=“你好\\nWorld”

double\似乎对我有用。

将字符串更改为

string ky=“你好\\nWorld”


double\似乎对我有用。

你试过
\r\n
插入新行吗?你试过
\r\n
插入新行吗?我认为没有必要,但
\n
对我有效\n在.net和javascript中都是新行操作符。我认为这没有必要,因为
\n
对我来说很有效\n在.net和javascript中都是新行运算符。