I’ve one asp.net page and I want to load text into the textArea control which is in aspx page from into a variable in code behind (C#):
Code behind:
System.Web.UI.HtmlControls.HtmlTextArea Output1 =
(System.Web.UI.HtmlControls.HtmlTextArea)(FindControl("textarea1"));
Output1.Value = Output.ToString();
ASP:
<div style ="width: 78%; float: right; height: 85px; display: block;"
class="message_text_box_left">
<textarea id="textarea1" name="textarea1" cols="30" rows="3"
class="message_text_box" title="Share your Idias here..."
tabindex="1" onkeyup="addrow_fun();"></textarea>
</div>
but it is giving error like
Object reference not set to an instance of an object.
You should add the
attribute to the text area.
Or, preferable you should use the
TextBoxASP.NET control and set theTextModeproperty toTextBoxMode.MultiLine. Example follows:Code behind:
ASP: