hi guys,

i want to give new line after fixed amount of characters(say after every 100 characters) in the textbox.as i have to display my news content which is very large.

pl guide me for that.thanks waiting for ur reply.

hey dude you can use this javascript, i have tried it in sample application. just change the "[COLOR="Red"]100[/COLOR]" with your requirement. I mean after the number of character you want [B]new line[/B].

<script language="javascript" type="text/javascript">
    var cntChar = 0    
    function GetKeyPress()
    {        
        if(cntChar == 100)
        {
            document.getElementById('TextBox1').value = document.getElementById('TextBox1').value + '\r\n';
            cntChar = 1;
        }
        else
        {
            cntChar = cntChar + 1;
        }        
    }
</script>

And in the Page_Load event. Add the below line..

TextBox1.Attributes.Add("OnKeyPress", "GetKeyPress();")[/COLOR]

hope it will solve your problem :-)

hi guys,

i want to give new line after fixed amount of characters(say after every 100 characters) in the textbox.as i have to display my news content which is very large.

pl guide me for that.thanks waiting for ur reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.