Modify InnerHtml of HtmlControl with JavaScript?

  • Thread starter Thread starter Paul
  • Start date Start date
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.
 
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)
 
Back
Top