Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.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
C# 如何从updatepanel中按钮所在的代码后面执行javascript_C#_Javascript_Fancybox - Fatal编程技术网

C# 如何从updatepanel中按钮所在的代码后面执行javascript

C# 如何从updatepanel中按钮所在的代码后面执行javascript,c#,javascript,fancybox,C#,Javascript,Fancybox,如何从updatepanel中按钮所在的代码后面执行javascript 我想在fancybox中打开一个div,我正在从代码背后打开它 它正在发挥作用 但我想把按钮放在updatepanel中 但在此之后,javascript不会触发 可能是因为我把它放在文件里了。准备好了吗 我们还能用什么来触发呢 html 代码隐藏 protected void Button1_Click(object sender, EventArgs e) { various.Attributes["href"] =

如何从updatepanel中按钮所在的代码后面执行javascript

我想在fancybox中打开一个div,我正在从代码背后打开它 它正在发挥作用 但我想把按钮放在updatepanel中 但在此之后,javascript不会触发 可能是因为我把它放在文件里了。准备好了吗 我们还能用什么来触发呢

html

代码隐藏

protected void Button1_Click(object sender, EventArgs e)
{
various.Attributes["href"] = "#inline";
fancyLtr.Text = "<script>jQuery(document).ready(function() {$(\"#ContentPlaceHolder1_various\").trigger('click');});</script>";
}
受保护的无效按钮1\u单击(对象发送者,事件参数e)
{
各种.Attributes[“href”]=“#inline”;
fancyLtr.Text=“jQuery(document).ready(function(){$(\”\ContentPlaceHolder1\u variable\”).trigger('click');}”);
}

感谢高级

为什么不使用
ScriptManager.RegisterStartupScript
?如果您能告诉我具体情况,请检查此问题的答案:非常感谢。它正在工作。只是需要一些时间,直到fancybox在3秒钟左右打开,我可以在它打开之前显示一些内容,还是可以让它更快
$(document).ready(function () {
$("#ContentPlaceHolder1_various").fancybox();
});
protected void Button1_Click(object sender, EventArgs e)
{
various.Attributes["href"] = "#inline";
fancyLtr.Text = "<script>jQuery(document).ready(function() {$(\"#ContentPlaceHolder1_various\").trigger('click');});</script>";
}