By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,186 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

ASP.net Javascript Error htmlfile: not implemented

P: n/a
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[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

Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Are you using RegisterStartupScript
or RegisterClientScriptBlock ?

Juan T. Llibre
ASP.NET MVP
===========
<da******@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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[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

Nov 19 '05 #2

P: n/a
No, I'm not. I will look into they're usage, as I am not familiar with
them. Thanks.

Nov 19 '05 #3

P: n/a
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.

Nov 19 '05 #4

P: n/a
da******@yahoo.com 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
Nov 19 '05 #5

P: n/a
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.

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.