开发者

Running Javascript to size an ASP.NET control once it is rendered or updated by a postback

I have an ascx control tha开发者_JS百科t is loaded in an aspx page. How can I instruct my ascx to run javascript once it is rendered in the browser. It should run on every postback as well.

I looked around but could not find a satisfactory answer.


Have you tried using the "RegisterStartupScript" method along with JQuery to call a JS function? This code might help you:

ScriptManager.RegisterStartupScript(Page, GetType(Page), "myScript", "$(function() {{ alert ('Your page is loaded.'); }});", True)

You can replace the alert with any JS function you want :)

I hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜