I'm building a website with text box containing log messages. the log is getting updated using AJAX.
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"
onload="textbox_load"
Height="110px"
TextMode="MultiLine"
Width="100%">
</asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
I need to scroll the text box down every time it gets updated. How?
Try some plain javascript. Here's a sample I think you can modify to work in your scenario:
You just have to figure out how to call the scrollDown method...
Why dont you try this simple example:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) {
Just change TextBox1 parameter with your text box name. You can see that the content in the text box is scrolled to bottom.
You can call this java script after AJAX is refreshing the content of your text box.
Handle the Sys.WebForms.PageRequestManager.endRequest event and scroll the textbox down: