views:

33

answers:

1

Hi. I have a modal extender called modal2 and when I call

$find('modal2').show();

It comes up with a classic error saying 'null' is null or not an object;

I searched google a bit and made all the related controls to be visible for testing purpose but it has not made any difference.

Any suggestions please?

Thanks.

+3  A: 

Hey,

Check the client ID; unless you are using clientIDmode of static, it would be something like: ct100_contentplaceholder_modal2 and so you have to do:

$find("<%= modal2.ClientID %>")

instead to properly get the ID.

HTH.

Brian
Awww. Thanks a lot for the quick reply, will try and let you know.
rlee923
can you put this code in a separate .js file? It doesn't seem to work :S
rlee923
I have create a javascript function and put it on .aspx file and it comes up with an error saying 'The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).'
rlee923
I just checked the client ID in .cs file using breakpoints and it definitely says 'modal2'...
rlee923
<%= %> can be within script; I usually put it within the form toward the bottom of the page. <%= %> syntax has to be in the ASPX page, not in JS file.
Brian
so I can put something like function showmodal2(){$find("<%= modal2.ClientID %>").show();}at the bottom of the aspx page?
rlee923
Now it seems to be working without error, but the panel is displayed at the bottom of the page rather than being a popup. Do you know what might be causing this?
rlee923
Would use IE 8 debugging tools or firefox + firebug to inspect the panel, see what might be pushing it down... Could be a CSS adversely affecting it, or maybe some HTML syntax error is causing it to freak out, I'm not sure.
Brian
In the end I found out what the problem is but, this really, should give out correct error messages for us to debug . One of the controls were having problems, and it was not ajax :(Thanks alot for your help.
rlee923
No problem, welcome to my world :-) I dislike that feature too, there are valid and invalid reasons for that...
Brian