Mind you, I am using master pages, but can I locate a div within the page and throw some html in there? Thanks.
With document. createElement() method you can create a specified HTML element dynamically in JavaScript. After creation you can add attributes. If you want the element to show up in your document, you have to insert in into the DOM-tree of the document.
You can set the InnerHtml attribute of just about any control. Whenyou need to have dynamic HTML, better to have a div in aspx page with an id and runat="server" then edit the HTML as You need in code-behind.
You can add a div with runat="server" to the page:
<div runat="server" id="myDiv"> </div>
and then set its InnerHtml property from the code-behind:
myDiv.InnerHtml = "your html here";
If you want to modify the DIV's contents on the client side, then you can use javascript code similar to this:
<script type="text/javascript"> Sys.Application.add_load(MyLoad); function MyLoad(sender) { $get('<%= div.ClientID %>').innerHTML += " - text added on client"; } </script>
Use asp:Panel
for that. It translates into a div.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With