如何显示ModalPopupExtender时指定的JavaScript运行 [英] How to specify javascript to run when ModalPopupExtender is shown

查看:150
本文介绍了如何显示ModalPopupExtender时指定的JavaScript运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ASP.NET AJAX ModalPopupExtender有OnCancelScript和OnOkScript属性,但它似乎并不有一个OnShowScript财产。我想指定一个JavaScript函数来弹出显示每次运行。

The ASP.NET AJAX ModalPopupExtender has OnCancelScript and OnOkScript properties, but it doesn't seem to have an OnShowScript property. I'd like to specify a javascript function to run each time the popup is shown.

在过去的情况下,我设置的TargetControlID到一个虚拟控制,并提供我自己的控制,首先做一些JS code,然后使用JS的方法来显示弹出。但在这种情况下,我表示从客户端和服务器端的code中的弹出窗口。

In past situations, I set the TargetControlID to a dummy control and provide my own control that first does some JS code and then uses the JS methods to show the popup. But in this case, I am showing the popup from both client and server side code.

任何人都知道的一种方式做到这一点?

Anyone know of a way to do this?

顺便说一句,我需要这个,因为我有,我想打一个TinyMCE的编辑模态一个文本框。但TinyMCE的初始化脚本不会对隐形文本框工作,所以我必须找到一种方法,在模态中显示的时间运行它。

BTW, I needed this because I have a textbox in the modal that I want to make a TinyMCE editor. But the TinyMCE init script doesn't work on invisible textboxes, so I had to find a way to run it at the time the modal was shown

推荐答案

嗯......我的 pretty确保的存在是对MPE a所示的事件...这是关我的头顶,但我认为你可以在Page_Load中添加事件处理程序的显示事件

hmmm... I'm pretty sure that there's a shown event for the MPE... this is off the top of my head, but I think you can add an event handler to the shown event on page_load

function pageLoad()
{
var popup = $find('ModalPopupClientID');
popup.add_shown(SetFocus);
}

function SetFocus()
{
$get('TriggerClientId').focus();
}

\r
\r

我不知道是否寿,这将帮助你从服务器端调用寿

i'm not sure tho if this will help you with calling it from the server side tho

这篇关于如何显示ModalPopupExtender时指定的JavaScript运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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