Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Execute a javascript which is inside the control after visibled

$
0
0

I have a control that is invisible when page loaded like this:

<script type="text/javascript">
function myFunc() {
    // do somthing
}</script><a runat="server" id="aFileLink" ></a><asp:Image runat="server" ID="imgThumbnail" />

this control is inside of an update panel. I wanna to run myFunc() function when I set the visibility of control to true. so I have written this line after the visibility of control is set to true:

ScriptManager.RegisterClientScriptBlock(Page,typeof(Page),"","myFunc();",true);

However, when control is shown an error is raised and say the method "myFunc" is unknown. Why? It seems my script block never execute because when I wrote simple "alert" function inside it, it didn't work after control showing!!!! I checked the source of page after showing control and I saw "myFunc" and "alert" functions!


Viewing all articles
Browse latest Browse all 5678

Trending Articles