【问题标题】:how can i scroll to specific line in a webforms TexetBox using c# [duplicate]我如何使用c#滚动到Web表单TextBox中的特定行[重复]
【发布时间】:2013-08-01 14:13:06
【问题描述】:

我有一个 TextBox 多行,我需要滚动到文本框中的特定行.. 请帮帮我

Page.ClientScript.RegisterStartupScript(this.GetType(), "check", "<script type=\'text/javascript\'>document.getElementById('" + this.textbox.ClientID + "').scrollHeight=100;</script>");

【问题讨论】:

    标签: asp.net


    【解决方案1】:

    您尝试过使用 scrollTop 吗?

    例如

    function scrollTextBox()
    {
        var textBox = document.getElementById("<%= TextBox1.ClientID %>");
        textBox.scrollTop = 30;
    }
    

    您需要使用行号计算 scrollTop 值。

    【讨论】:

    • 感谢您的回复,但没有成功
    猜你喜欢
    • 2010-10-18
    • 2010-11-16
    • 1970-01-01
    • 2020-05-28
    • 2011-10-26
    • 2020-09-24
    • 2019-12-27
    • 1970-01-01
    • 2015-12-16
    相关资源
    最近更新 更多