Last post Mar 25, 2017 04:13 PM by Morky073
Mar 25, 2017 01:12 PM|Morky073|LINK
Have a function the writes a div element in the code behind, based on a variety of circumstances/ conditions that are only evaluated in the code behind.
response.write ("<div id=\"mydivname\" runat="server">somecontent + more HTML elements</div>");
in a later function in the code behind, how can I access and update of the contents of the div?
trying mydivname.InnerHtml will not work.
Control Controlmydivname = FindControl("mydivname");
if (Controlmydivname != null)
Controlmydivname.Innerhtml = "new data"
Mar 25, 2017 01:31 PM|mgebhard|LINK
You'll need to rethink your approach. Only server controls or markup with runat="server" attribute are visible to the code behind.
This will not work as the HTML is written to the response directly.
The Panel server control renders as a div. I suggest that you add a panel to your markup so that you can modify the contents from the code behind.
Mar 25, 2017 04:13 PM|Morky073|LINK
will try the panel approach.