我在一个事件内,在这个事件中我希望有一个javascript警告向用户显示一条消息.但我似乎无法让这个工作.
protected void dgvStaff_Deleting(object sender, Infragistics.Web.UI.GridControls.RowDeletingEventArgs e)
{
// Code stub
object test = e.Row.Items[0].Text;
//ScriptManager.RegisterStartupScript(this, this.GetType(), "alertbox", "ShowPopup('Select a row to rate');", true);
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertbox", "ShowPopup('Select a row to rate');", true);
if (objGatewayFunctions.CheckStaffAssignment(e.Row.Items[0].Text.ToString(), ConfigurationManager.AppSettings.Get("Connection").ToString()) == true)
{
}
}
Run Code Online (Sandbox Code Playgroud)
知道我在这里做错了什么吗?
你不能这样做 - C#和JavaScript在不同的计算机上运行,你不能在函数中间跳转它们.
通常,您会延迟错误/警告,直到呈现页面.为了改善用户体验,还尝试在回发到服务器之前进行错误检查(除了服务器端检查).
| 归档时间: |
|
| 查看次数: |
478 次 |
| 最近记录: |