I
imbirek8
Hi! I would like to call Javascript function from code behind.
Everything was working until I put UpdatePanel. Why this code is not
working any more ? How to repair it ?
<head runat="server"><title></title>
<script type="text/javascript"> function aaa(){ alert('hello');}
</script>
</head>
<body><form id="form1" runat="server"><div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button"
onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div></form></body></html>
<asp:ScriptManager ID="smHfhr" runat="server"></asp:ScriptManager>
protected void Button1_Click(object sender, EventArgs e)
{
if (!ClientScript.IsClientScriptBlockRegistered("mytest"))
ClientScript.RegisterClientScriptBlock(this.GetType(), "mytest",
"<script>aaa();</script>");
}
Thanks for help
Everything was working until I put UpdatePanel. Why this code is not
working any more ? How to repair it ?
<head runat="server"><title></title>
<script type="text/javascript"> function aaa(){ alert('hello');}
</script>
</head>
<body><form id="form1" runat="server"><div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button"
onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div></form></body></html>
<asp:ScriptManager ID="smHfhr" runat="server"></asp:ScriptManager>
protected void Button1_Click(object sender, EventArgs e)
{
if (!ClientScript.IsClientScriptBlockRegistered("mytest"))
ClientScript.RegisterClientScriptBlock(this.GetType(), "mytest",
"<script>aaa();</script>");
}
Thanks for help