$(document).ready和RegisterStartupScript [英] $(document).ready and RegisterStartupScript

查看:76
本文介绍了$(document).ready和RegisterStartupScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用$(document).ready函数在页面上添加自定义单选按钮.现在,我必须根据某些条件在页面上添加一个确认对话框.我必须在后面的代码中添加RegisterStartupScript.但是它在$(document).ready函数开始之前没有弹出.在确认对话框出现之前如何使其启动.在此先感谢您.

解决方案

(document).ready函数可在页面上添加自定义单选按钮.现在,我必须根据某些条件在页面上添加一个确认对话框.我必须在后面的代码中添加RegisterStartupScript.但是它在


(文档)之前开始弹出.在确认对话框出现之前如何使其启动.预先谢谢.在这种情况下,我们只需使用.NET的Register Script方法来发出JavaScript代码,这是绝对好的.

如果您使用的是jQuery,则可以编写要在


中执行的事件的逻辑流程

I am using $(document).ready function to add custom radio buttons on the page. Now I had to add a confirm dialog on the page depending on some condition. I had to add RegisterStartupScript in code behind . But Its popping up at the beginning before $(document).ready function is not firing. How to make it fire before the confirm dialog shows up. Thanks in advance.

解决方案

(document).ready function to add custom radio buttons on the page. Now I had to add a confirm dialog on the page depending on some condition. I had to add RegisterStartupScript in code behind . But Its popping up at the beginning before


(document).ready function is not firing. How to make it fire before the confirm dialog shows up. Thanks in advance.


In ASP.NET web apps, most of the times we would need to call JavaScript functions in page_load event of code behind, for various valid reasons. In such scenarios, we simply use .NET’s Register Script methods for emitting JavaScript code, which is absolutely fine.

If you are using jQuery, you would write the logical flow of events to be executed in


这篇关于$(document).ready和RegisterStartupScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆