Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript .NET
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>


 

Now, I want to give a rowindex and gridview should scrolls down to that row.
Javascript assistance is appreciated..
 
Thanks & Regards
Sri
Posted 4-Mar-13 21:06pm
Edited 6-Mar-13 0:34am
v5
Comments
Jameel Moideen at 5-Mar-13 2:14am
   
Please share the table structure generated by the Gridview in browser
cyanceenu at 5-Mar-13 2:22am
   
Its has 3 columns col1 number, col2 nvarchar(50), col3 nvarchar(200)
 
Thanks in anticipation
vimal_2010 at 6-Mar-13 5:18am
   
Please provide the html markup of the grid table structure.
cyanceenu at 6-Mar-13 5:30am
   
Hi Vimal, I have updated my question with HTML Markup, please have a look on my question, and thanks for your interest..

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can refer the article http://www.maratz.com/blog/archives/2005/05/18/detect-table-row-index-with-javascript/[^] to detect the row index with JavaScript.
 
One challenge on using RowIndex. If you use the below code,
this.parent.rowIndex 
then "this" in this.parent.rowIndex is the window. Not the td element.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 515
1 Maciej Los 340
2 Richard MacCutchan 265
3 BillWoodruff 225
4 Mathew Soji 155
0 OriginalGriff 8,804
1 Sergey Alexandrovich Kryukov 7,457
2 DamithSL 5,689
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411028.1 | Last Updated 9 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100