本文介绍了使用javascript转到Gridview中的特定行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个100条记录的网格。

它在Div和高度限制为400px,垂直滚动条上下滚动整个网格。



HTML标记如下所示......



I have a grid of 100 records.
It is in Div and height limited to 400px, a vertical scroll bar scrolls the whole grid up and down.

the HTML markup is like below...

<div id="dvClinicLookup"  runat="server" style="border: ridge 2px silver; border-radius: 5px;
                                    width: 99%; height: 191px; display: none">
                                    <table border="0">
                                        <tr>
                                            <td style="width: 26%">
                                                <font face="tahoma" size="2" color="black">Enter Keywords to search</font>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtClinicKeywords" runat="server" Width="50%">
                                                <asp:Button ID="btnFind" runat="server" Text="Find" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <div id="dv"  runat="server" style="overflow-y: scroll; height: 156px; border: solid 1px silver;">
                                                    <asp:GridView ID="gvClinicLookup1" runat="server" AutoGenerateColumns="false" DataSourceID="dsAllClinics"
                                                        Width="100%" Font-Names="verdana" Font-Size="Smaller" EnableViewState="true">
                                                        <HeaderStyle Height="20px" BackColor="#465c71" ForeColor="White" Font-Bold="true" />
                                                        <rowstyle backcolor="Ivory" font-names="Verdana" />
                                                        <alternatingrowstyle backcolor="White" font-names="Verdana" />
                                                        <columns>
                                                            <asp:BoundField DataField="CLNCode" HeaderText="Clinic Code" ItemStyle-Width="12%"
                                                                HeaderStyle-BorderColor="Black" />
                                                            <asp:BoundField DataField="CLNEtiqaName" HeaderText="Clinic Name" ItemStyle-Width="30%"
                                                                HeaderStyle-BorderColor="Black" />
                                                            <asp:BoundField DataField="address" HeaderText="Clinic Address" ItemStyle-Width="58%"
                                                                HeaderStyle-BorderColor="Black" />
                                                        </columns>

                                                    <asp:SqlDataSource ID="dsAllClinics" runat="server" ConnectionString="<%$ ConnectionStrings:medix_HISDB %>"
                                                        SelectCommand="[spGetAllClinics]" SelectCommandType="StoredProcedure">
                                                        <SelectParameters>
                                                            <asp:SessionParameter Name="ClinicName" SessionField="ClinicName" Type="String" />
                                                        </SelectParameters>


                                            </td>
                                        </tr>
                                    </table>











现在,我想给一个rowindex和gridview应该向下滚动到那一行。

Javascript协助表示赞赏..



谢谢&问候

Sri






Now, I want to give a rowindex and gridview should scrolls down to that row.
Javascript assistance is appreciated..

Thanks & Regards
Sri

推荐答案











现在,我想要给一个rowindex和gridview应向下滚动到那一行。

Javascript协助表示赞赏..



谢谢&问候

Sri






Now, I want to give a rowindex and gridview should scrolls down to that row.
Javascript assistance is appreciated..

Thanks & Regards
Sri


this.parent.rowIndex 



然后this.parent.rowIndex中的this就是窗口。不是td元素。


then "this" in this.parent.rowIndex is the window. Not the td element.


这篇关于使用javascript转到Gridview中的特定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 17:16