0

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.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by rohand
0

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.

Edited by Reverend Jim: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.