accessing table cell programmatically

M

ma

Hello,



I want to inject a piece of JavaScript inside a table cell. How can I do
this?

The table is statically created on master page.



Regards
 
G

Guest

Hello,

I want to inject a piece of JavaScript inside a table cell. How can I do
this?

The table is statically created on master page.

Regards

a JavaScript to do what?
 
P

Patrice

Be more accurate please.You can change the content of a cell using
MyTD.innerHTML='whatever'; or you can trigger some JavaScript code by
handling the table cell events, but it doesn't mean you have to place those
scripts "inside" the table cell.

Explain perhaps a bit more what you are trying to do. If you are familiar
with JavaScript, what is the problem you run into compared with what you are
usually doing
 
M

ma

Patrice said:
Be more accurate please.You can change the content of a cell using
MyTD.innerHTML='whatever'; or you can trigger some JavaScript code by
handling the table cell events, but it doesn't mean you have to place
those scripts "inside" the table cell.

Explain perhaps a bit more what you are trying to do. If you are familiar
with JavaScript, what is the problem you run into compared with what you
are usually doing



Hello,

I want to use this graph object in my asp code:

http://www.codeproject.com/jscript/dhtml_graph.asp



If I add the text from this demo (the code which is provided on the web and
shows how to use the graph), I can see the graph on web site. I also add it
to the cell that I want to display and I got the result. I want to create
the code based on my data and then set it in a way that it appears on the
specific place (inside a cell ) but I am not successful. Any suggestion?



Regards
 
G

Guest

Hello,

I want to use this graph object in my asp code:

http://www.codeproject.com/jscript/dhtml_graph.asp

If I add the text from this demo (the code which is provided on the web and
shows how to use the graph), I can see the graph on web site. I also add it
to the cell that I want to display and I got the result. I want to create
the code based on my data and then set it in a way that it appears on the
specific place (inside a cell ) but I am not successful. Any suggestion?

Regards

The following line

bg.parent = document.getElementById('here');

set the parent object for the Graph

"here" is the id of the specific cell

<td id=here align=center></td>

So, all what you need is to define id for the table cell where your
Graph has to be presented.
 
M

ma

Anon User said:
The following line

bg.parent = document.getElementById('here');

set the parent object for the Graph

"here" is the id of the specific cell

<td id=here align=center></td>

So, all what you need is to define id for the table cell where your
Graph has to be presented.

Thanks. How can I add the script into generate page?
should I use Responce.write or ....?

Regards
 
G

Guest

Thanks. How can I add the script into generate page?
should I use Responce.write or ....?
the code based on my data and then set it in a way that it appears on
the specific place (inside a cell )

So, the javascript code can be included into aspx in the <head></head>
block, or programmatically, using RegisterClientScriptBlock
http://msdn2.microsoft.com/en-us/library/btf44dc9.aspx

Then the table you generating on the page should have a cell with
id="here"

e.g.

Response.Write "<td id=here align=center></td>"

or

HtmlTableRow r = new HtmlTableRow();
HtmlTableCell c = new HtmlTableCell();
c.ID = "here";
r.Cells.Add(c);
....
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top