gpt4 book ai didi

c# - 无法在确认框中使用\n 获取新行

转载 作者:行者123 更新时间:2023-12-02 19:30:19 25 4
gpt4 key购买 nike

下面是我的代码

btnDelete.Attributes.Add("onclick", "{return ConfirmAction('You are about to Delete Order . Please Note \r\n  1. Order no longer can be retrieved \r\n 2. Changes to the order are not saved. \r\n Are you sure you wish to continue to Delete?')};");

我希望确认框显示带有"is"和“取消”按钮的消息,如下所示:

您即将删除订单。请注意:
1.订单无法再检索
2.订单更改不会保存
您确定要继续删除吗?

我尝试了 "\n"、 '\n' 和 "\r\n"但仍然无法插入行。

最佳答案

字符串中有一个字符串,因此您需要转义反斜杠:

btnDelete.Attributes.Add("onclick", "{return ConfirmAction('You are about to Delete Order . Please Note \\n  1. Order no longer can be retrieved \\n 2. Changes to the order are not saved. \\n Are you sure you wish to continue to Delete?')};");

关于c# - 无法在确认框中使用\n 获取新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11567692/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com