Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted
Comments
[no name] 11-Oct-13 5:03am    
have you tried google???
Zafar Sultan 11-Oct-13 5:22am    
Can you post the code that you have written so far?

Hi Friends,
I tried something like below and it worked.
Sharing with you.

JavaScript
<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;
                }


It works .. :)

Thanks,
Lok..
 
Share this answer
 
Another simple approach.
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..
 
Share this answer
 
v2
Comments
Lokesh Zende 15-Oct-13 4:58am    
Thanks Rohan. This also works.
Shrikant Bhongade 19-Apr-16 3:24am    
Thanks its work.
System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "document.getElementById('" + btnSave.ClientID + "').style.visibility='hidden';", true);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900