How to insert html code section into a particular place using codebehind on page load
asp.net, c#, code-behind, codeblocks, html
Solution
Create a div with an ID and a runat="server":
<div ID="divErrorMessage" runat="server" class="divErrorMessage"></div>
Then from your Page_Load event in the code behind, you can set the inner html of the div:
divErrorMessage.InnerHtml = "Your message";
Setting the flag, runat="server" makes the control available in the code behind
Problem
I have an aspx page where I need to check and display an error message on the page on `page_load`. The error message is below: ``` <div class="errorMessage">The user ID or password you entered does not match our records. Please try again. <br /> You may also securely recover your <a href="#">User ID</a> or reset your <a href="#">Password</a> online. </div> ``` this code block should be added to the page after chechking some conditions...and that part and some other functions are implemented in code behide function `page_load()` how do i do this using only the behind the code in `page_load()` function without writing it inline in the aspx file?