Search code examples
c#ascx

scroll down and focus on table row on click of button


I have a table where there are 75 rows with a button on every row. When I click on a button at some row it will display some result and page will refresh. We need to scroll down and see the result. Is there any way to scroll and focus on the particular row where we clicked the button?


Solution

  • We can use the Anchor tag to the button.

    <a href="#someName" id="someID" runat="server"><asp:Button ID="btnID" Text="MoreInfo" runat="server"/></a>
    

    and then use the anchor tag id and focus.

    someID.focus()
    

    It will focus on the row of the table where we clicked the button