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!