C# c中弹出框中的新行#
单击GridView的行后,我将使用下面的代码生成弹出窗口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
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中都是新行运算符。