I have created a website with a working registration and login. However, I ran into some trouble when trying to make a little forum. What I want the forum to do is creating a div containing the message when the user filled a textbox and submitted it by clicking on a button.
The question is, how can I add html to my div by just using code? This is what I have already.
protected void Submit_Click(object sender, EventArgs e)
{
if (Message.Text != null)
{
HtmlGenericControl post = new HtmlGenericControl("div");
HtmlGenericControl message = new HtmlGenericControl("p");
message.InnerText = Message.Text;
post.Controls.Add(message);
}
else
{
}
}
Any help or suggestions are appreciated, thank you.