如何调用从母版页一个javascript? [英] How to call a javascript from master page?
问题描述
我试图从母版页,在这里我得到了一个更新面板调用JavaScript警报。内的一个按钮和一个文本框。
I'm trying to call a javascript alert from a master page, where i got an update panel. Within that a button and a text box.
我要呼吁一下在我的母版页按钮报警。到目前为止,似乎不工作。请帮助。
I need to call the alert on clicking the button in my master page. So far it seems not working. Please help.
Page.ClientScript.RegisterStartupScript
(this.GetType(), "alert", "invokeMeMaster();", true);
这是我在我的按钮点击写道。 invokerMEMaster仅包含一个警告message.I需要重新加载警觉的OK按钮点击该页面。我怎样才能做到这一点呢?
This is what i wrote in my button click. invokerMEMaster include just an alert message.I need to reload the page on the ok button click of the alert. How can i do that as well?
推荐答案
更新面板清除JavaScript的code当回发所以尽量把这个code的标题。
Update Panel clears javascript code when Postback so try to put this code on the header.
<script type="text/javascript">
$(document).ready(
function(){
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {//put your code here}
});
</script>
这篇关于如何调用从母版页一个javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!