Multi-line textbox scrolled to bottom?

Discussion in 'ASP .Net Web Controls' started by Dav, Jul 11, 2006.

  1. Dav

    Dav Guest

    I need to enable a button when a multi-line textbox has been scrolled to the
    bottom. Can anyone tell me if it's possible to do this with client-side
    script and/or server code?

    Thanks!
     
    Dav, Jul 11, 2006
    #1
    1. Advertising

  2. Hi,

    Thank you for your post.

    I think you can use javascript to check the current scroll position of the
    textarea (multi-line textbox):

    <script language="javascript">
    function check()
    {
    form1.button1.disabled = !(form1.text1.scrollTop ==
    (form1.text1.scrollHeight - form1.text1.clientHeight));
    }
    </script>

    You do this check in the onscroll event of the textarea, you can set the
    onscroll event in Page_Load:

    text1.Attributes.Add("onscroll", "javascript:check();");

    Hope this helps. Please feel free to post here if anything is unclear.

    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Walter Wang [MSFT], Jul 12, 2006
    #2
    1. Advertising

  3. Dav

    Dav Guest

    Worked like a charm! Thank you!

    "Walter Wang [MSFT]" wrote:

    > Hi,
    >
    > Thank you for your post.
    >
    > I think you can use javascript to check the current scroll position of the
    > textarea (multi-line textbox):
    >
    > <script language="javascript">
    > function check()
    > {
    > form1.button1.disabled = !(form1.text1.scrollTop ==
    > (form1.text1.scrollHeight - form1.text1.clientHeight));
    > }
    > </script>
    >
    > You do this check in the onscroll event of the textarea, you can set the
    > onscroll event in Page_Load:
    >
    > text1.Attributes.Add("onscroll", "javascript:check();");
    >
    > Hope this helps. Please feel free to post here if anything is unclear.
    >
    > Regards,
    > Walter Wang (, remove 'online.')
    > Microsoft Online Community Support
    >
    > ==================================================
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    > ==================================================
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
     
    Dav, Jul 13, 2006
    #3
  4. Hi,

    Appreciate your update and response. I am glad to hear that the problem has
    been fixed. If you have any other questions or concerns, please do not
    hesitate to contact us. It is always our pleasure to be of assistance.

    Have a nice day!

    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Walter Wang [MSFT], Jul 14, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Timo
    Replies:
    4
    Views:
    487
    clintonG
    May 8, 2004
  2. Dan
    Replies:
    1
    Views:
    8,404
    ainigma
    Apr 4, 2008
  3. Noozer
    Replies:
    1
    Views:
    7,228
    Carolyn Marenger
    Mar 13, 2006
  4. Cuthbert
    Replies:
    8
    Views:
    455
    Ancient_Hacker
    Sep 13, 2006
  5. Cal Who
    Replies:
    3
    Views:
    843
    Cal Who
    Dec 5, 2009
Loading...

Share This Page