Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法使用codebehind将脚本插入asp页_Javascript_Asp.net_Code Behind - Fatal编程技术网

Javascript 无法使用codebehind将脚本插入asp页

Javascript 无法使用codebehind将脚本插入asp页,javascript,asp.net,code-behind,Javascript,Asp.net,Code Behind,在我的asp.net/c页面中有一个简单的gridview控件。我想在删除我的行时显示一条消息,显示“delete successful”(删除成功)。我尝试使用该控件,但没有效果。 我的代码是 script = string.Format(@"<script type='text/javascript'>alert('Successfully deleted');</script>"); if (Page != null && !Page.ClientS

在我的asp.net/c页面中有一个简单的
gridview
控件。我想在删除我的行时显示一条消息,显示“delete successful”(删除成功)。我尝试使用该控件,但没有效果。
我的代码是

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);
}
script=string.Format(@“警报('Successfully deleted');”;
if(Page!=null&&!Page.ClientScript.IsClientScriptBlockRegistered(“警报”))
{
Page.ClientScript.RegisterClientScriptBlock(Page.GetType(),“警报”,脚本);
}
有谁能帮我一下吗,我是新来的….

塔克斯
-Vishu

请尝试以下方法:

ScriptManager.RegisterStartupScript(this.Page , typeof(Page) , Guid.NewGuid().ToString() , "alert('Successfully deleted');" , true);
希望它能起作用试试这个

代码

Page.ClientScript.RegisterStartupScript(this.GetType(), "Call my function", "popup();", true);
function popup() {
    $("#popupdiv").fadeIn('slow');
 }
其中,popup()是一个javascript函数

脚本

Page.ClientScript.RegisterStartupScript(this.GetType(), "Call my function", "popup();", true);
function popup() {
    $("#popupdiv").fadeIn('slow');
 }

popupdiv是您可以根据需求设计的div的Id

JQuery没有标记,这改变了他试图做的事情。
$(“#popupdiv”).fadeIn('slow')是jQuery。