Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all

i Have TextArea in Asp.Net
I set it in UpdatePannel With Timer
When TextArea Refresh Its Have Scroll and Scroll in Top .
But I Need Scroll Of Textarea In Down Set
How?
Posted

1 solution

Hi Seyed,

You can do this by executing a simple JavaScript on whenever the "refresh" event occurs.

XML
<script type="text/javascript" language="javascript">   
         Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);      
         function EndRequestHandler(sender, args) {
             var TextAreaDiv= document.getElementById("TextAreaDiv");
             TextAreaDiv.scrollTop = TextAreaDiv.scrollHeight;            
        }      

    </script>


Replace the TextAreaDiv with the ID of Div containing TextArea or of the element providing scroll facility to TextArea.

You need to put this code snippet inside <head> tag or inside the <body>. As you're using UpdatePanel I must assume that you have placed a Script Manager on your aspx page.

Hope this helps!
Happy Coding :)

Sunny_K
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900