locked
if object null RRS feed

  • Question

  • User-1835835255 posted

    i have this java script code

    <script type = "text/javascript">     var GridId = "<%= LoginView1.FindControl("GridView1").ClientID %>"; </script>

    If the object is not on the screen it gives me an error.

    Microsoft JScript runtime error: Object required


    Thats because the object is not on the screen yet.  How do I check to see if the object is null before it trys to find the object?  If its not there yet dont try to find it, if it is there find it.  Thanks

    Tuesday, September 25, 2012 12:45 PM

Answers

  • User-1835835255 posted

    What i ended up doing was a work-around.  I moved this code to where the object was not null b/c when it was null it would throw that error.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 26, 2012 8:28 PM

All replies

  • User-691245060 posted

    try it like this - 

    <%= (condition) ? if-true : if-false %> 

    Thanks,

    Tuesday, September 25, 2012 12:49 PM
  • User-1835835255 posted

    What i ended up doing was a work-around.  I moved this code to where the object was not null b/c when it was null it would throw that error.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 26, 2012 8:28 PM