0

I have 2 pages that has a huge dynamic generated table on each. The tables are almost identical so instead of having the code in two places, I am making the table a user control that can be added to each page.

There is some client side script that changes row color or hides and shows text based on radio button clicks. The code works perfectly in the original aspx page but in the new page that has the user control in it I get Object Expected in this code on the if line.

var controlName = "AdditionalQuestionTable" + QuestionNumber + "_Yes";
if ($('#' + controlName).get(0) != null)
    {
        $('#' + controlName).get(0).className = 'visible';
    }

I have ClientIDMode set to Static on both and I can see the ids are the same on both pages. I am stumped. When I do View Source and look at the rendered code for each they are identical as shown below.

<table id="AdditionalQuestionTable3_Yes" class="hidden" style="width:100%;">


<table id="AdditionalQuestionTable3_Yes" class="hidden" style="width:100%;">

Any help would be greatly appreciated. Thanks.

Rhonda

6
  • how does the variable "QuestionNumber " get set? Commented Apr 6, 2012 at 0:17
  • It's a parameter that gets passed in on the click event. Commented Apr 6, 2012 at 16:03
  • The only other thing i can think of, is make sure you have the jQuery js file loaded on the second page. Commented Apr 6, 2012 at 18:33
  • Another thing that is interesting. If I do this if (document.getElementById(controlName) != null) { document.getElementById(controlName).className = 'hidden'; } It works. Commented Apr 6, 2012 at 18:56
  • Well then it definitely sounds like your jquery script is missing / failed to load. But doesn't sound like it either. Commented Apr 6, 2012 at 19:01

1 Answer 1

1

The Object Expected was caused by the jquery script file missing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.