views:

1084

answers:

2

I have this in a page :

<textarea id="taEditableContent" runat="server" rows="5"></textarea>
<ajaxToolkit:DynamicPopulateExtender ID="dpeEditPopulate" runat="server" TargetControlID="taEditableContent"
        ClearContentsDuringUpdate="true" PopulateTriggerControlID="hLink" ServicePath="/Content.asmx"
        ServiceMethod="EditContent" ContextKey='<%=ContextKey %>' />

Basically, a DynamicPopulateExtender that fills the contents of a textarea from a webservice. Problem is, no matter how I return the line breaks, the text in the text area will have no line feeds.

If I return the newlines as "br/" the entire text area remains empty. If I return new lines as "/r/n" , I get all the text as one continous line. The webservice returns the string correctly:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://rprealm.com/"&gt;First line


Third line
Fourth line</string>

But what I get in the text area is :

First line Third line Fourth line
A: 

Try to add the following style on textarea: style="white-space: pre"

Ricky Supit
Nope ,same result :-(
Radu094
+1  A: 

The problem is that the white space is ignored by default when the XML is processed. Try to add the xml:space="preserve" attribute to the string element. You'll also need to define the xml prefix as xmlns:xml="http://www.w3.org/XML/1998/namespace".

csgero