Mar 30, 2010

12:38 AM - , No comments

Scroll to the bottom of textbox as default

You want your textbox auto scroll to the bottom instead of the top as default page load?

Okie, do it like this:

Winform:

txtMyText.SelStart = Len(txtMyTest.Text)

:D

Ofcouse I don't mention about Winform app, you can find variety of solutions in Google. I want to talk about asp.net. Okie, not take your time:
Place this snip code on your LoadPage (aspx, javascript, does not .cs)

var txtMyText = window.document.getElementById("<%=txtMyText.ClientID %>");
txtMyText.doScroll();
txtMyText.scrollTop = txtMyText.scrollHeight;

Hope this help :)

0 comments:

Post a Comment