Как сохранить фокус на выбранной строке при загрузке страницы?
Привет, ребята, я создал gridview внутри с div, чтобы сделать его прокручиваемым . но когда я выбираю загрузку страницы, вызывающую div обратно наверх. как я могу сохранить позицию div ? вот мой код.
Что я уже пробовал:
<div style="width: 100%; height:200px; overflow: auto; border: solid black; border-radius: 5px; "> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display." > <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="studentid" HeaderText="studentid" SortExpression="studentid" /> <asp:BoundField DataField="studname" HeaderText="studname" SortExpression="studname" /> <asp:BoundField DataField="subjectid" HeaderText="subjectid" SortExpression="subjectid" /> <asp:BoundField DataField="grade" HeaderText="grade" SortExpression="grade" /> <asp:BoundField DataField="section" HeaderText="section" SortExpression="section" /> <asp:BoundField DataField="quarter" HeaderText="quarter" SortExpression="quarter" /> <asp:BoundField DataField="totalnumberpt" HeaderText="totalnumberpt" SortExpression="totalnumberpt" /> <asp:BoundField DataField="totalscoreofpt" HeaderText="totalscoreofpt" SortExpression="totalscoreofpt" /> <asp:BoundField DataField="maxscoreofpt" HeaderText="maxscoreofpt" SortExpression="maxscoreofpt" /> <asp:BoundField DataField="percentageofpt" HeaderText="percentageofpt" SortExpression="percentageofpt" /> <asp:BoundField DataField="weightedscorept" HeaderText="weightedscorept" SortExpression="weightedscorept" /> <asp:BoundField DataField="ptrs1" HeaderText="ptrs1" SortExpression="ptrs1" /> <asp:BoundField DataField="ptms1" HeaderText="ptms1" SortExpression="ptms1" /> <asp:BoundField DataField="ptrs2" HeaderText="ptrs2" SortExpression="ptrs2" /> <asp:BoundField DataField="ptms2" HeaderText="ptms2" SortExpression="ptms2" /> <asp:BoundField DataField="ptrs3" HeaderText="ptrs3" SortExpression="ptrs3" /> <asp:BoundField DataField="ptms3" HeaderText="ptms3" SortExpression="ptms3" /> <asp:BoundField DataField="ptrs4" HeaderText="ptrs4" SortExpression="ptrs4" /> <asp:BoundField DataField="ptms4" HeaderText="ptms4" SortExpression="ptms4" /> <asp:BoundField DataField="ptrs5" HeaderText="ptrs5" SortExpression="ptrs5" /> <asp:BoundField DataField="ptms5" HeaderText="ptms5" SortExpression="ptms5" /> <asp:BoundField DataField="ptrs6" HeaderText="ptrs6" SortExpression="ptrs6" /> <asp:BoundField DataField="ptms6" HeaderText="ptms6" SortExpression="ptms6" /> <asp:BoundField DataField="ptrs7" HeaderText="ptrs7" SortExpression="ptrs7" /> <asp:BoundField DataField="ptms7" HeaderText="ptms7" SortExpression="ptms7" /> <asp:BoundField DataField="ptrs8" HeaderText="ptrs8" SortExpression="ptrs8" /> <asp:BoundField DataField="ptms8" HeaderText="ptms8" SortExpression="ptms8" /> <asp:BoundField DataField="ptrs9" HeaderText="ptrs9" SortExpression="ptrs9" /> <asp:BoundField DataField="ptms9" HeaderText="ptms9" SortExpression="ptms9" /> <asp:BoundField DataField="ptrs10" HeaderText="ptrs10" SortExpression="ptrs10" /> <asp:BoundField DataField="ptms10" HeaderText="ptms10" SortExpression="ptms10" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:StConnectionString1 %>" ProviderName="<%$ ConnectionStrings:StConnectionString1.ProviderName %>" SelectCommand="SELECT [studentid], [studname], [subjectid], [grade], [section], [quarter], [totalnumberpt], [totalscoreofpt], [maxscoreofpt], [percentageofpt], [weightedscorept], [ptrs1], [ptms1], [ptrs2], [ptms2], [ptrs3], [ptms3], [ptrs4], [ptms4], [ptrs5], [ptms5], [ptrs6], [ptms6], [ptrs7], [ptms7], [ptrs8], [ptms8], [ptrs9], [ptms9], [ptrs10], [ptms10] FROM [tblpt]"> </asp:SqlDataSource> <div>