Object doesn't support this property or method

Discussion in 'ASP .Net' started by JohnE, Mar 9, 2010.

  1. JohnE

    JohnE Guest

    I have a gridview that has an arrow on it for show/hide the nested gridview.
    When I use the arrow I get the error listed in the subject line above. Here
    is the javascript that is being used. The error comes back to the 2 'var'
    lines.

    <script language="javascript" type = "text/javascript">

    function switchViews(obj, row)
    {
    var div = window.opener.document.getElementByID(obj);
    var img = window.opener.document.getElementByID('img' + obj);

    if(div.style.display == "none")
    {
    div.style.display = "inline";

    if (row == 'alt')
    {
    img.src = "../Images/expand_button_white_alt_down.jpg"
    mce_src = "../Images/expand_button_white_alt_down.jpg";
    }
    else
    {
    img.src = "../Images/Expand_Button_white_Down.jpg"
    mce_src = "../Images/Expand_Button_white_Down.jpg";
    }
    img.alt = "Close to view other change requests";
    }
    else
    {
    div.style.display = "none";

    if (row == "alt")
    {
    img.src = "../Images/expand_button_white_alt.jpg"
    mce_src = "../Images/expand_button_white_alt.jpg";
    }
    else
    {
    img.src = "../Images/expand_button_white.jpg"
    mce_scr = "../Images/expand_button_white.jpg";
    }

    img.alt = "Use to show children."
    }
    }

    </script>

    This is located on a webapp webform (nested masterpage) inside the
    <asp:Content></asp:Content tag.

    Does anyone see what is wrong with this or what is missing? Hope so,
    because I don't.

    Thanks...John
     
    JohnE, Mar 9, 2010
    #1
    1. Advertising

  2. JohnE

    JohnE Guest

    Nevermind. I found the error as to why I was getting the error. I have the
    ..getElementByID when it should be .getElementById. Uppercase versus
    lowercase 'd'. Case sensitive.



    "JohnE" wrote:

    > I have a gridview that has an arrow on it for show/hide the nested gridview.
    > When I use the arrow I get the error listed in the subject line above. Here
    > is the javascript that is being used. The error comes back to the 2 'var'
    > lines.
    >
    > <script language="javascript" type = "text/javascript">
    >
    > function switchViews(obj, row)
    > {
    > var div = window.opener.document.getElementByID(obj);
    > var img = window.opener.document.getElementByID('img' + obj);
    >
    > if(div.style.display == "none")
    > {
    > div.style.display = "inline";
    >
    > if (row == 'alt')
    > {
    > img.src = "../Images/expand_button_white_alt_down.jpg"
    > mce_src = "../Images/expand_button_white_alt_down.jpg";
    > }
    > else
    > {
    > img.src = "../Images/Expand_Button_white_Down.jpg"
    > mce_src = "../Images/Expand_Button_white_Down.jpg";
    > }
    > img.alt = "Close to view other change requests";
    > }
    > else
    > {
    > div.style.display = "none";
    >
    > if (row == "alt")
    > {
    > img.src = "../Images/expand_button_white_alt.jpg"
    > mce_src = "../Images/expand_button_white_alt.jpg";
    > }
    > else
    > {
    > img.src = "../Images/expand_button_white.jpg"
    > mce_scr = "../Images/expand_button_white.jpg";
    > }
    >
    > img.alt = "Use to show children."
    > }
    > }
    >
    > </script>
    >
    > This is located on a webapp webform (nested masterpage) inside the
    > <asp:Content></asp:Content tag.
    >
    > Does anyone see what is wrong with this or what is missing? Hope so,
    > because I don't.
    >
    > Thanks...John
    >
    >
     
    JohnE, Mar 9, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. todd
    Replies:
    3
    Views:
    5,871
  2. Roman
    Replies:
    0
    Views:
    4,063
    Roman
    Jan 4, 2004
  3. zdrakec
    Replies:
    0
    Views:
    610
    zdrakec
    Sep 26, 2007
  4. Joe
    Replies:
    3
    Views:
    567
  5. shank
    Replies:
    5
    Views:
    136
    Chris Barber
    Oct 31, 2003
Loading...

Share This Page