I am trying to display an UpdateProgress via JavaScript, however the JavaScript keeps erroring out with "Object Expected". I know that the client ID of the UpdateProgress is correct. What am I missing? I've tried both get$() and document.getElementById and
single/double quotes. Per the link below, it should work. The UpdateProgress controls exist on user controls.
Please use fiddler to check the style of UpdateProgress. See display/visibility and size propery. With fiddler, you can click the element in run-time html code and you'll see where the element is.
//Show the Update Progress
$get('ContentPlaceHolder1_UpdateProgress1').style.display = 'block';
//Do some other processing here...
//Hide the UpdateProgress now that processing is complete:
$get('ContentPlaceHolder1_UpdateProgress1').style.display = 'none';
Please use fiddler to check the style of UpdateProgress. See display/visibility and size propery. With fiddler, you can click the element in run-time html code and you'll see where the element is.
//Show the Update Progress $get('ContentPlaceHolder1_UpdateProgress1').style.display = 'block'; //Do some other processing here... //Hide the UpdateProgress now that processing is complete: $get('ContentPlaceHolder1_UpdateProgress1').style.display = 'none';
I have. I have also confirmed the ID of the control via DebugBar. The only thing that I found odd was that the showing in DebugBar is not encapsulated in single or double quotes.
According to your description, it seems like that you are using jQuery.get() to load data from the server using a HTTP GET request. Before using it, please make sure that you have added the code below at first:
If it doesn't work, please use IE Developer Tools (just press F12 in IE) to check whether the client ID of the UpdateProgressor is correct. For detais about how to use it, please check the links below:
1) I'm not loading any data from the server. The UpdateProgress exists on the client side already as confirmed when the an actual AJAX update is initiated and per the information proved by DebugBar. The element exists.
2) The correct client ID of the UpdateProgress exists in the JavaScript as confirmed via DebugBar and when I inspect the Source directly.
3) I have tried get$() as well as document.getElementById
I think I just got it. It is a problem with the logic. The page has multiple child controls, but only one of which is displayed at any given time based on querystring parameters. The user selects which one to display from a select. When the select is changed,
the page uses window.location.href to reload itself but with the new querystring parameters thus the new child control is displayed. The logic was looking for a particular object based on the
new value of the select and not the old value. It wasn't finding the element as it didn't exist.
dch3
Member
447 Points
638 Posts
Unable to Access UpdateProgress Control via JavaScript
Nov 14, 2012 04:32 PM|LINK
I am trying to display an UpdateProgress via JavaScript, however the JavaScript keeps erroring out with "Object Expected". I know that the client ID of the UpdateProgress is correct. What am I missing? I've tried both get$() and document.getElementById and single/double quotes. Per the link below, it should work. The UpdateProgress controls exist on user controls.
http://msdn.microsoft.com/en-us/library/bb398821(v=vs.100).aspx
function ChangeMainPanel() { var qspProjectNumber = getQueryStringParameter("ProjectNumber"); if (qspProjectNumber.length == 0) { var URL = "Setup_Detail.aspx?savequerystring=yes&view=" + document.getElementById("DropDownListSelectMainPanel").value; } else { var URL = "Setup_Detail.aspx?savequerystring=yes&view=" + document.getElementById("DropDownListSelectMainPanel").value + "&ProjectNumber=" + getQueryStringParameter("ProjectNumber"); } var panel = $get("DropDownListSelectMainPanel").value; window.alert(panel); switch (panel) { case "PanelGeneralInformation": window.alert("PanelGeneralInformation"); get$('Setup_GeneralInformation_UpdateProgressShowSetup').style.display = "block"; break; case "PanelShowContacts": window.alert("PanelContacts"); get$('Setup_Contacts_UpdateProgressShowSetup').style.display = "block"; break; default: } window.location.href=URL; }chetan.sarod...
All-Star
66629 Points
11270 Posts
Re: Unable to Access UpdateProgress Control via JavaScript
Nov 15, 2012 02:09 AM|LINK
Please use fiddler to check the style of UpdateProgress. See display/visibility and size propery. With fiddler, you can click the element in run-time html code and you'll see where the element is.
//Show the Update Progress $get('ContentPlaceHolder1_UpdateProgress1').style.display = 'block'; //Do some other processing here... //Hide the UpdateProgress now that processing is complete: $get('ContentPlaceHolder1_UpdateProgress1').style.display = 'none';http://forums.asp.net/t/1767564.aspx/1
</div>Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
dch3
Member
447 Points
638 Posts
Re: Unable to Access UpdateProgress Control via JavaScript
Nov 15, 2012 12:34 PM|LINK
Did you actually read the entire post?
Kenshinofkin
Member
94 Points
99 Posts
Re: Unable to Access UpdateProgress Control via JavaScript
Nov 15, 2012 07:51 PM|LINK
Try $get("<%= idOfControl.ClientID %>").style.display = "block";
dch3
Member
447 Points
638 Posts
Re: Unable to Access UpdateProgress Control via JavaScript
Nov 15, 2012 07:53 PM|LINK
I have. I have also confirmed the ID of the control via DebugBar. The only thing that I found odd was that the showing in DebugBar is not encapsulated in single or double quotes.
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: Unable to Access UpdateProgress Control via JavaScript
Nov 20, 2012 05:23 AM|LINK
Hi,
According to your description, it seems like that you are using jQuery.get() to load data from the server using a HTTP GET request. Before using it, please make sure that you have added the code below at first:
Then modify your code as follows:
document.getElementById("<%=Setup_Contacts_UpdateProgressShowSetup.ClientID %>").style.display = "block";or
$get("<%=Setup_Contacts_UpdateProgressShowSetup.ClientID %>").style.display = "block";If it doesn't work, please use IE Developer Tools (just press F12 in IE) to check whether the client ID of the UpdateProgressor is correct. For detais about how to use it, please check the links below:
http://msdn.microsoft.com/en-us/library/ie/gg589507(v=vs.85).aspx
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store
dch3
Member
447 Points
638 Posts
Re: Unable to Access UpdateProgress Control via JavaScript
Nov 25, 2012 02:26 PM|LINK
1) I'm not loading any data from the server. The UpdateProgress exists on the client side already as confirmed when the an actual AJAX update is initiated and per the information proved by DebugBar. The element exists.
2) The correct client ID of the UpdateProgress exists in the JavaScript as confirmed via DebugBar and when I inspect the Source directly.
3) I have tried get$() as well as document.getElementById
dch3
Member
447 Points
638 Posts
Re: Unable to Access UpdateProgress Control via JavaScript
Nov 25, 2012 02:55 PM|LINK
I think I just got it. It is a problem with the logic. The page has multiple child controls, but only one of which is displayed at any given time based on querystring parameters. The user selects which one to display from a select. When the select is changed, the page uses window.location.href to reload itself but with the new querystring parameters thus the new child control is displayed. The logic was looking for a particular object based on the new value of the select and not the old value. It wasn't finding the element as it didn't exist.