我的asp.net/c#页面中有一个简单的gridview
控件我希望在删除我的行时显示“删除成功”的消息我尝试使用它但它没有效果。
我的代码就是这个..
script = string.Format(@"<script type='text/javascript'>alert('Successfully deleted');</script>");
if (Page != null && !Page.ClientScript.IsClientScriptBlockRegistered("alert"))
{
Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "alert", script);
}
任何人都可以帮助我,我是新手。
Thaks
-Vishu
答案 0 :(得分:0)
请试试这个:
ScriptManager.RegisterStartupScript(this.Page , typeof(Page) , Guid.NewGuid().ToString() , "alert('Successfully deleted');" , true);
希望它可能有用
答案 1 :(得分:0)
试试这个......
<强> CODE 强>:
Page.ClientScript.RegisterStartupScript(this.GetType(), "Call my function", "popup();", true);
其中 popup()是一个javascript函数。
<强> SCRIPT 强>:
function popup() {
$("#popupdiv").fadeIn('slow');
}
popupdiv 是您可以根据自己的要求设计的div的ID