【发布时间】:2011-12-16 13:43:43
【问题描述】:
我想从 c# 代码而不是 JavaScript 显示一个确认框。 当以下条件为真时,有什么方法可以弹出确认框?
这是目前为止的代码:
if (items.SelectedNode.ChildNodes.Count >= 1)
{
ScriptManager.RegisterStartupScript(this.nav_tree_items, typeof(string), "Alert", "alert('Hello');", true);
}
我已经尝试过 add.attributes,但这不起作用。
我也尝试了以下操作,但单击取消后它仍然执行操作:
if (items.SelectedNode.ChildNodes.Count >= 1)
{
ScriptManager.RegisterStartupScript(this.nav_tree_items, typeof(string), "Confirm", "Confirm('Hello');", true);
}
【问题讨论】:
-
我必须有条件,才应该允许确认框。所以我更喜欢 c# 会比 JavaScript 更好