Reputation: 841
I am using HtmlAgilityPack and it seems I cannot set the value of the text in a textarea in the same way as an input field:
var node = doc.DocumentNode.SelectSingleNode("//textarea");
if (node != null)
{
node.SetAttributeValue("value", record.Data);
}
Does anyone know how this can be done?
Upvotes: 2
Views: 2558
Reputation: 46351
A <textarea>
element doesn't have a value
attribute. It's content is it's own text node:
<textarea>
Some content
</textarea>
To access that, use the .InnerHtml
property:
var node = doc.DocumentNode.SelectSingleNode("//textarea");
if (node != null)
{
node.InnerHtml = record.Data;
}
Upvotes: 2