ASP.net Javascript Error htmlfile: not implemented

Discussion in 'ASP .Net' started by damonl73@yahoo.com, Jan 12, 2005.

  1. Guest

    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="javascript">
    function ShowGridHeader()
    {
    if (typeof grdData == "undefined")
    {
    alert("undefined")
    }
    else
    {
    alert("defined")
    var rgWidths = new Array();
    ------> tblDataHeader.rows[0].cells.length =
    grdData.rows[0].cells.length;
    for (var i = 0; i < grdData.rows[0].cells.length; i++)
    {
    tblDataHeader.rows[0].cells = grdData.rows[0].cells;
    rgWidths = grdData.rows[0].cells.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
    , Jan 12, 2005
    #1
    1. Advertising

  2. Are you using RegisterStartupScript
    or RegisterClientScriptBlock ?



    Juan T. Llibre
    ASP.NET MVP
    ===========
    <> wrote in message
    news:...
    > 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="javascript">
    > function ShowGridHeader()
    > {
    > if (typeof grdData == "undefined")
    > {
    > alert("undefined")
    > }
    > else
    > {
    > alert("defined")
    > var rgWidths = new Array();
    > ------> tblDataHeader.rows[0].cells.length =
    > grdData.rows[0].cells.length;
    > for (var i = 0; i < grdData.rows[0].cells.length; i++)
    > {
    > tblDataHeader.rows[0].cells = grdData.rows[0].cells;
    > rgWidths = grdData.rows[0].cells.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, Jan 12, 2005
    #2
    1. Advertising

  3. Guest

    No, I'm not. I will look into they're usage, as I am not familiar with
    them. Thanks.
    , Jan 12, 2005
    #3
  4. Guest

    If by not using RegisterStartupScript
    or RegisterClientScriptBlock 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.
    , Jan 12, 2005
    #4
  5. RobG Guest

    wrote:
    > 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.


    Then ASP is irrelevant. Just discuss the code at the client, how you
    generate it at the server is for some other forum.

    > Here is the
    > javascript code within my asp.net page which runs OnLoad:
    >
    > <script language="javascript">


    language has been depreciated, use:

    <script type="text/javascript">

    > function ShowGridHeader()
    > {
    > if (typeof grdData == "undefined")
    > {
    > alert("undefined")
    > }


    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.

    > else
    > {
    > alert("defined")
    > var rgWidths = new Array();
    > ------> tblDataHeader.rows[0].cells.length =
    > grdData.rows[0].cells.length;


    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.createElement.

    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="tblDataTable">
    <thead id="tblDataHeader">
    <tr onclick="alert(this.cells.length);">
    <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.getElementById ) {
    tbleDataHeader = document.getElementById('tblDataHeader')
    } else if (document.all) {
    tbleDataHeader = document.all['tblDataHeader'];
    }

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

    var elementRef = document.createElement('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
    RobG, Jan 13, 2005
    #5
  6. Guest

    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.
    , Jan 13, 2005
    #6
  7. tom_tregenna

    Joined:
    May 2, 2008
    Messages:
    1
    damonl73,

    From what I understand of your issue, I had a similar problem when attempting to call a local function from a Web Service callback handler, such that the following code (which gets some data from a Web Service before allowing a drag'n'drop operation) would produce the error you mention:

    function ServiceCallSucceeded(response, userContext, methodName) {
    if (methodName == "ObjectClicked") {
    document.onmousemove = DragObject(userContext);
    document.onmouseup = DropObject(userContext);
    }
    }

    In my case, the resolution to this issue was to encapsulate the function calls in new inline functions as follows:

    function ServiceCallSucceeded(response, userContext, methodName) {
    if (methodName == "ObjectClicked") {
    document.onmousemove = function() { DragObject(userContext); }
    document.onmouseup = function() { DropObject(userContext); }
    }
    }

    The callback handler is now able to call local functions 'DragObject' and 'DropObject' without producing the 'htmlfile: not implemented' error.

    I hope this helps someone, even though this thread is 3 years old!

    - T
    tom_tregenna, May 2, 2008
    #7
    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. Replies:
    0
    Views:
    509
  2. JT
    Replies:
    2
    Views:
    659
  3. Genival Carvalho

    htmlfile: Invalid pointer :0 ?

    Genival Carvalho, May 31, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    169
    Genival Carvalho
    Jun 1, 2004
  4. Pedro Rafael

    file upload(htmlfile: access is denied)

    Pedro Rafael, Sep 22, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    371
  5. Replies:
    5
    Views:
    131
Loading...

Share This Page