本文介绍了禁用Update Panel外部的控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我有一个只有Timer控件的UpdatePanel。

在Timer的OnTick事件中,我正在检查某些条件。如果条件为真,我想禁用UpdatePanel外面的按钮。

你能帮我吗?



谢谢,

Lok ..

Hi Friends,
I have an UpdatePanel with only Timer control inside it.
On OnTick event of Timer, I am checking certain conditions. If condition is true I want to disable the button which is outside the UpdatePanel.
Could you please help me at this ?

Thanks,
Lok..

推荐答案

<script language="javascript" type="text/javascript">
                Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);

                function BeginRequestHandler(sender, args) {
                    elem = args.get_postBackElement();
                }

                function EndRequestHandler(sender, args) {
// tmrTimer is my timer control inside update panel
// btnCloseModules is button control outside update panel
                    if (elem.id == "ctl00_MainContentPlaceHolder_tmrTimer")
                        document.getElementById("ctl00_MainContentPlaceHolder_btnCloseModules").disabled = true;
                }





工作.. :)



谢谢,

Lok ..



It works .. :)

Thanks,
Lok..


System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "document.getElementById('" + your_button.ClientID + "').disabled='true';", true);



来源: [ ^ ]



问候..


Source: Call javascript function from codebehind in asp.net[^]

Regards..


这篇关于禁用Update Panel外部的控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 11:33