如何在更新面板中的按钮点击事件上调用javascript函数? [英] how to call javascript function on button click event which is in update panel?
本文介绍了如何在更新面板中的按钮点击事件上调用javascript函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的按钮位于更新面板中。在那个按钮点击事件结束时,我需要调用javascript函数。我使用ClientScriptManager但它不起作用..
ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(this.GetType(), CallMyFunction,javascript:insertAtCaret('+ controlId +','+ placeholder +');,true);
解决方案
当你正在使用ASP.Net的更新面板,那么你应该通过
ScriptManager.RegisterStartupScript( this .Page, this .GetType(), MyFun1, functionName(),真跨度>);
my button is placed in update panel. on end of that button click event i need to call javascript function. i used ClientScriptManager but it doesnt work..
ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(this.GetType(), "CallMyFunction", "javascript:insertAtCaret('" + controlId + "','" + placeholder + "' );", true);
解决方案
when you are using Update Panel of ASP.Net, then you should call javascript function by the
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "MyFun1", "functionName()", true);
这篇关于如何在更新面板中的按钮点击事件上调用javascript函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文