How do I reference the input of an HTML <textarea> control in codebehind?
First make sure you have the runat="server"
attribute in your textarea
tag like this
<textarea id="TextArea1" cols="20" rows="2" runat="server"></textarea>
Then you can access the content via:
string body = TextArea1.value;
You are not using a .NET control for your text area. Either add runat="server"
to the HTML TextArea control or use a .NET control:
Try this:
<asp:TextBox id="TextArea1" TextMode="multiline" Columns="50" Rows="5" runat="server" />
Then reference it in your codebehind:
message.Body = TextArea1.Text;
You need to use runat="server"
like this:
<textarea id="TextArea1" cols="20" rows="2" runat="server"></textarea>
You can use the runat=server attribute with any standard HTML element, and later use it from codebehind.