Read html contents

  • Thread starter Thread starter MarkD
  • Start date Start date
M

MarkD

I have a page that calculates a large formula in javascript and I display
the results in a td.innerHTML. We now want save that value in a db, but
since its not a label how can I access that value in codebehind?

Thanks in advance,
MarkD
 
How about td.InnerHTML?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
You need to set the td tag to runat=server and give the td element an id.
You can then access the innerHtml of the td element as follows:

protected System.Web.UI.HtmlControl.HtmlTableCell td1;

<--Your data connection and stored proceedures omitted -->
string whatever=td1.innerHtml;

you can stuff a data parameter with that string whatever.

I hope that helps

Sam-
 
I think this method gets me on the right track, but the client side data
result is not available. It just returns empty string. The runat=server
allows me access to the td, but the server side doesn't know about the
containg data because of the javascript.
 
Maybe try stuffing the td element and a string in your codebehind
syncronously then.
 
Instead of the td, why don't you use a regular txt box with the
following style and readonly="true"?

style="BORDER:none;BACKGROUND-COLOR:Transparent"

Hope this helps.
 
I actually did something very similar. I left the td alone because I have
exensive sytles applied to it, but I just added an asp:textbox with 0 width
and when I write the value to the td, I also write
document.getElementbyID('txtResult').value = result. I kinda figured I could
do this the whole time, but I was just hoping to keep a minimal amount
server controls on the page.

Thanks to all,
MarkD
 

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

Back
Top