asp.net页面中的滚动问题太长 [英] scrolling problem in asp.net page too long

查看:68
本文介绍了asp.net页面中的滚动问题太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面,其中有5个表要插入值..我的问题是页面太长,我必须对每个表进行验证,因此在向最后一个表中输入数据时,我必须输入多个值一个这样的页面会在每个条目上加载,因此每次刷新都会导致我的问题是我每次都必须向下滚动才能在最后一个表中输入条目,任何人都可以建议我每次重新加载焦点时都应使用的任何方法回到表中,我正在输入值,所以我每次都不会向下滚动

i have a page which has 5 tables to insert values ....my problem is that page is too long and i have to do validations on each table so while entering data into last table i have to enter multiple value one by one so page loads on every entry so page refreshes every time my problem is that i have to scroll down every time for entry in last table ,,,,,,,,can anyone suggest me any method in which everytime page reloads the focus should come back to the table i am entering values into so i dont to scroll down everytime

推荐答案

有一种解决方案可能会对您有所帮助

在每5个表格上添加以下属性
There is a solution which might help you

On every 5 table add the below property
onclick="MakeSelected(this)">



以下是
的实现



Below is the implementation of the

<script language="javascript" type="text/javascript">
       function MakeSelected(ctrl) {
           document.getElementById(''<%= hdnVal.ClientID%>'').value = ctrl.id;
       }
   </script


我在页面上创建了一个名为"hdnVal"的隐藏控件,以便我们可以保留所选表的ID.

现在在< form>结束之前标签只需添加以下代码


I created a hidden control on the page with the name "hdnVal" so that we can preserve the ID of the selected table.

Now before end of the <form> tag just add below code

<script language="javascript" type="text/javascript">
       if (document.getElementById(''<%= hdnVal.ClientID%>'') != null && document.getElementById(''<%= hdnVal.ClientID%>'').value != "")
           document.getElementById(document.getElementById(''<%= hdnVal.ClientID%>'').value).focus();
   </script>



所以你的代码看起来像那样



SO your code would look like that

<head runat="server">
    <script language="javascript" type="text/javascript">
        function MakeSelected(ctrl) {
            document.getElementById(''<%= hdnVal.ClientID%>'').value = ctrl.id;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input type="hidden" runat="server" id="hdnVal" />
        <table width="600" cellpadding="0" cellspacing="0" id="table1" onclick="MakeSelected(this)">
            <tr>
                <td>
                </td>
            </tr>
        </table>
    </div>
    <script language="javascript" type="text/javascript">
        if (document.getElementById(''<%= hdnVal.ClientID%>'') != null && document.getElementById(''<%= hdnVal.ClientID%>'').value != "")
            document.getElementById(document.getElementById(''<%= hdnVal.ClientID%>'').value).focus();
    </script>
    </form>
</body>


请有人回答我的答案


为什么您不能将每个表放入其自己的滚动div元素?
Why can''t you put each of the tables into their own scrolling div elements?


这篇关于asp.net页面中的滚动问题太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆