views:

59

answers:

1

I have and ASP.NET 3.5 page where I need to debug some JavaScript code.

    function checkAll(isChecked)
    {
      debugger;
      var dataGridElements = document.getElementById('" + DataGridSearchResults.ClientID + @"').getElementsByTagName('input');
      for (var i = 0; i < dataGridElements.length; i++)
      {
        var e = dataGridElements[i];
        if ((e.type=='checkbox') && (!e.disabled)) 
        {
          e.checked = isChecked;
        }
      }
    }

As you can see, I added a debugger statement in the first line. For some reason, when i execute the page, the javascript (which is in a string variable and registered with Page.ClientScript.RegisterClientScript statement) is in my source code twice! The second block doesn't have my debugger statement either! I checked the project, this block of Javascript is only listed once in the project.

Any ideas? (the client i am running on is IE8 if that makes a difference)

+1  A: 

Figured it out. The base page that this control was on (the javascript was in an ASCX file) was a page that had a tab strip on it. One of the other tabs had the code copy and pasted with the exact same signature, just a grid name difference. Once i changed the signature on my set of code, it worked fine.

Rob