2013-02-15 63 views
2

我在我的asp.net/c#页面中有一个简单的gridview控件我想显示一条消息,显示删除我的行时“删除成功”我尝试使用此但它没有效果。
我的代码是这个..无法使用代码隐藏将脚本插入到asp页面

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

请试试这个:

ScriptManager.RegisterStartupScript(this.Page , typeof(Page) , Guid.NewGuid().ToString() , "alert('Successfully deleted');" , true); 

希望它可以工作

+0

感谢很多的div标识...它工作得很好:) – 2013-02-15 07:52:01

+0

请接受anenswer then – Moons 2013-02-15 07:55:39

0

试试这个...

CODE

Page.ClientScript.RegisterStartupScript(this.GetType(), "Call my function", "popup();", true); 

其中弹出()是JavaScript函数。

SCRIPT

function popup() { 
    $("#popupdiv").fadeIn('slow'); 
} 

popupdiv是ü可以按您的要求设计

+0

JQuery没有被标记,这改变了他想要做的事情。 – webnoob 2013-02-15 08:20:18

+0

@webnoob这不是jQuery。这是javacript .. – coder 2013-02-15 09:05:32

+0

'$(“#popupdiv”)。fadeIn('slow');'是jQuery。 – webnoob 2013-02-15 09:07:45

相关问题