hallo!
hab gerade das problem, dass ich in einer ajax-app eine mutiline-textbox habe, die automatisch befüllt wird.
ähnlich wie in einem logfile, soll aber immer die letzte zeile angezeigt werden.
die textbox soll also automatisch immer mit dem cursor am ende stehen bzw ganz zum ende scrollen.
unter c# ist das ja recht einfacht (scrolltocaret)
in asp.net ab ichs noch nicht herausgefunden....
wäre für jede hilfe dankbar, auch fertige usercontrols sind möglich
mfg scheri
textBox.SelectionStart = textBox.Text.Length;
textBox.ScrollToCaret();
Coding Styles are like assholes, everyone has one and no one likes one!
wie in meinem ersten beitrag erwähnt, funktioniert das in asp.net nicht!
es gibt keine member für scrolltocaret
hast du keine andere idee?
oder vll eine control-alternative. es muss nur readonly sein (logging), aber halt mehrzeilig.
keine Ahnung wie man dieses problem löst, hab auch schon gegoogelt, aber auch nix gefunden
sry
Coding Styles are like assholes, everyone has one and no one likes one!
so
ich habs jetzt soweit, dass die textbox zum ende scrollt, aber sie springt sofort wieder zum anfang zurück... 🙁
hier mein js-code:
<script type="text/javascript">
function scrollDown(input) {
input.scrollTop = input.scrollHeight - input.clientHeight;
}
</script>
und im pageload hab ich folgendes hinzugefügt:
btPrompt.Attributes.Add("onclick", "scrollDown(this.form." + tbLog.ClientID + ")");
warum springt meine textbox sofort wieder an den anfang? hat das etwas mit dem focus zu tun?
mfg scheri