breakline in asp:textbox

UrKo

Newcomer
Joined
May 12, 2009
Messages
11
Hi,

I'm using this code to put breaklines in asp:textbox, but the thing i don't like is, that when i edit the data, the br are seen.

Code:
<script type="text/javascript">
<!--
    function changeTextBoxValue(elementRef) {
        var textBoxValue = elementRef.value;

        while (true) {
            var currentValue = textBoxValue;

            textBoxValue = textBoxValue.replace('\n', '<br />');

            if (textBoxValue == currentValue)
                break;
        }

        elementRef.value = textBoxValue;
    }
// -->
</script>

does anyone has a better code and that are saved in db, but if you edit the data text will be in next line but without <br>
 
Can you not simply run the replace code only when you output the data from the database? So it will be stored in your db as \r\n or whatever, but before you output the data you replace that value in the string you fetched from the db.
 
Back
Top