473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Modify InnerHtml of HtmlControl with JavaScript?

Here is my current code:
------------
<script runat=Server>
void Page_Load(object sender, EventArgs e){
if (!IsPostBack){
myDiv.InnerHtml = "Original Content";
}
//On Postback, should equal "Original Content and New Content"
string strContent = myDiv.InnerHtml;
}
</script>
<script language=javascript>
function changeDiv(){
myDiv.innerHTML = myDiv.innerHTML + " and New Content";
document.forms(0).submit();
}
</script>
<form runat=Server>
<input type=button name=button value=Change onClick="changeDiv()">
</form>
<DIV id=myDiv runat=Server/>
------------

I need to be able to return the NEW InnerHtml value of "myDiv". The
original value is maintained in the ViewState, but does not reflect
the changes made with Javascript.

I don't want to use the client-side innerHTML property to retrieve the
data. Basically, I am trying to find a way to maintain state when the
changes to the control are client-side.

Any ideas? Thanks.
Nov 17 '05 #1
1 2026
the browser only postbacks input , textarea, and selects, not the entire
html. the server code never see any changes made to div by client script.

-- bruce (sqlwork.com)

"Paul" <pa***************@yahoo.com> wrote in message
news:35**************************@posting.google.c om...
Here is my current code:
------------
<script runat=Server>
void Page_Load(object sender, EventArgs e){
if (!IsPostBack){
myDiv.InnerHtml = "Original Content";
}
//On Postback, should equal "Original Content and New Content"
string strContent = myDiv.InnerHtml;
}
</script>
<script language=javascript>
function changeDiv(){
myDiv.innerHTML = myDiv.innerHTML + " and New Content";
document.forms(0).submit();
}
</script>
<form runat=Server>
<input type=button name=button value=Change onClick="changeDiv()">
</form>
<DIV id=myDiv runat=Server/>
------------

I need to be able to return the NEW InnerHtml value of "myDiv". The
original value is maintained in the ViewState, but does not reflect
the changes made with Javascript.

I don't want to use the client-side innerHTML property to retrieve the
data. Basically, I am trying to find a way to maintain state when the
changes to the control are client-side.

Any ideas? Thanks.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: scorpion53061 | last post by:
I really like this javascript for an image slideshow. The only thing I woudl like to do differently is have a cell above the image and navigation that would allow text content to be placed. Does...
4
by: michael.schwarz | last post by:
Hello, is it possible to get a HtmlControl from a string including the HTML code in .NET 2.0? I was using the TemplateControl.ParseControl method in .NET 1.1, but this is not working in the new...
11
by: tlyczko | last post by:
Hello Rob B posted this wonderful code in another thread, http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/c84d8538025980dd/6ead9d5e61be85f0#6ead9d5e61be85f0 I could not...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
15
by: Inny | last post by:
Hello, I found this simple js star rating script that I want to modify slightly. firstly I want to retain current vote , say 3 stars, untill its changed again. right now it resets to unvoted...
5
by: kidders | last post by:
Below is a script i need to modify to work and its driving me nuts. Essentially it fades the content of an array. The original script specified the object name, I tried to modify it to allow an...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.