Hi,
I have a page that opens a webdialog when a user presses a buttone , the dialog contains a webdropdown control. When the dropdown value is changed i want to show a DIV and hide another DIV.
I'm using this command var div = document.getElementById("incidentSpecificQuestions"); , but the value is always NULL because it's not in the DOM tree. How can l work around this?
Any Help?
HI Naish,
It is hard to say why you can not find DIV which is probably rendered by your application. I suggest you to look at generated html and search for that 'incidentSpecificQuestions' string.If there is element with that id, but getElementById fails, then it is rather strange.I think you should provide a simple sample (aspx) which contains dialog and your 'incidentSpecificQuestions' and how you search for that element. There is no need in the rest like dropdown, because they should be irrelevant.
Problem solved , when l viewed the HTML source after the dialog was display the div is called
addNewHelpdeskDialog_tmpl_incidentSpecificQuestions
Thanks for the help
Hi Naish,
If "incidentSpecificQuestions" is ID of server control located in dialog, then instead of hard coded addNewHelpdeskDialog_tmpl_incidentSpecificQuestions, I suggest to use ClientID.
Old codes:var div = $get('addNewHelpdeskDialog_tmpl_incidentSpecificQuestions');
Suggested codes:var div = $get('<%=incidentSpecificQuestions.ClientID%>');