Modify InnerHtml of HtmlControl with JavaScript?

P

Paul

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

bruce barker

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)
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top