ASP.net Javascript Error htmlfile: not implemented

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • damonl73@yahoo.com

    ASP.net Javascript Error htmlfile: not implemented

    Hi. I'm relatively new to asp.net and very new to javascript. I'm
    attempting to modify table cells after my page has loaded. Here is the
    javascript code within my asp.net page which runs OnLoad:

    <script language="javas cript">
    function ShowGridHeader( )
    {
    if (typeof grdData == "undefined" )
    {
    alert("undefine d")
    }
    else
    {
    alert("defined" )
    var rgWidths = new Array();
    ------> tblDataHeader.r ows[0].cells.length =
    grdData.rows[0].cells.length;
    for (var i = 0; i < grdData.rows[0].cells.length; i++)
    {
    tblDataHeader.r ows[0].cells[i] = grdData.rows[0].cells[i];
    rgWidths[i] = grdData.rows[0].cells[i].offsetWidth;
    }
    }
    }
    </script>

    I'm getting an "htmlfile: not implemented" error. It gives me the
    alert box and then fails on the line I indicated with an arrow. I have
    been unable to find any documentation of this error. Anyone have any
    suggestions?

    Thanks,
    D

  • Juan T. Llibre

    #2
    Re: ASP.net Javascript Error htmlfile: not implemented

    Are you using RegisterStartup Script
    or RegisterClientS criptBlock ?



    Juan T. Llibre
    ASP.NET MVP
    ===========
    <damonl73@yahoo .com> wrote in message
    news:1105561766 .634544.271150@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    > Hi. I'm relatively new to asp.net and very new to javascript. I'm
    > attempting to modify table cells after my page has loaded. Here is the
    > javascript code within my asp.net page which runs OnLoad:
    >
    > <script language="javas cript">
    > function ShowGridHeader( )
    > {
    > if (typeof grdData == "undefined" )
    > {
    > alert("undefine d")
    > }
    > else
    > {
    > alert("defined" )
    > var rgWidths = new Array();
    > ------> tblDataHeader.r ows[0].cells.length =
    > grdData.rows[0].cells.length;
    > for (var i = 0; i < grdData.rows[0].cells.length; i++)
    > {
    > tblDataHeader.r ows[0].cells[i] = grdData.rows[0].cells[i];
    > rgWidths[i] = grdData.rows[0].cells[i].offsetWidth;
    > }
    > }
    > }
    > </script>
    >
    > I'm getting an "htmlfile: not implemented" error. It gives me the
    > alert box and then fails on the line I indicated with an arrow. I have
    > been unable to find any documentation of this error. Anyone have any
    > suggestions?
    >
    > Thanks,
    > D
    >[/color]


    Comment

    • damonl73@yahoo.com

      #3
      Re: ASP.net Javascript Error htmlfile: not implemented

      No, I'm not. I will look into they're usage, as I am not familiar with
      them. Thanks.

      Comment

      • damonl73@yahoo.com

        #4
        Re: ASP.net Javascript Error htmlfile: not implemented

        If by not using RegisterStartup Script
        or RegisterClientS criptBlock would it execute my script at all? It
        starts to execute the scripts gives a run-time error when I try to set
        ...cells.length .

        Comment

        • RobG

          #5
          Re: ASP.net Javascript Error htmlfile: not implemented

          damonl73@yahoo. com wrote:[color=blue]
          > Hi. I'm relatively new to asp.net and very new to javascript. I'm
          > attempting to modify table cells after my page has loaded.[/color]

          Then ASP is irrelevant. Just discuss the code at the client, how you
          generate it at the server is for some other forum.
          [color=blue]
          > Here is the
          > javascript code within my asp.net page which runs OnLoad:
          >
          > <script language="javas cript">[/color]

          language has been depreciated, use:

          <script type="text/javascript">
          [color=blue]
          > function ShowGridHeader( )
          > {
          > if (typeof grdData == "undefined" )
          > {
          > alert("undefine d")
          > }[/color]

          This script does not define grdData anywhere, so it is undefined. Your
          script will stop execution right there - at least that is what the
          code instructs the browser to do and what both IE and Firefox did for
          me.
          [color=blue]
          > else
          > {
          > alert("defined" )
          > var rgWidths = new Array();
          > ------> tblDataHeader.r ows[0].cells.length =
          > grdData.rows[0].cells.length;[/color]

          You can't set 'length'. It's like telling a tree how many apples
          it has. ...cells.length will return the number of cells in a row (IE
          will also return the number of cells in a table if asked), are you
          trying to use it to tell the row to create that number of cells?

          If so, this is not how to do it. Learn about document.create Element.

          Where have you defined "tblDataHeader" ? It seems to be a reference to
          a table header (thead) element, but ... ?

          To get a reference to an HTML element, give it an id, then get a
          reference to it. Suppose your HTML looks like:

          <table id="tblDataTabl e">
          <thead id="tblDataHead er">
          <tr onclick="alert( this.cells.leng th);">
          <td>blah1</td>
          <td>blah2</td>
          </tr>
          </thead>
          <tbody>
          <tr><td>&nbsp ;</td><td>&nbsp;</td></tr>
          </tbody>
          </table>

          You can get a reference to the thead by:

          var tbleDataHeader;
          if ( document.getEle mentById ) {
          tbleDataHeader = document.getEle mentById('tblDa taHeader')
          } else if (document.all) {
          tbleDataHeader = document.all['tblDataHeader'];
          }

          If you are trying to create an element (say a table element), use:

          var elementRef = document.create Element('table' );

          I think it would be best if you say what you are trying to achieve,
          since your script is pretty broken it's impossible to tell what you are
          trying to do.


          --
          Rob

          Comment

          • damonl73@yahoo.com

            #6
            Re: ASP.net Javascript Error htmlfile: not implemented

            All objects are declared elsewhere. In the debugger I can see the
            values of all objects listed, so I know that is not my problem. What
            I'm trying to do is dynamically format the tblDataHeader table. I was
            attempting to set the length in order to set the number of columns in
            the table. The ultimate goal here is to get a data grid with a
            scrollable detail and fixed headers. Thanks.

            Comment

            Working...