Skip to content Skip to sidebar Skip to footer

Asp.net How To Maintain Scroll Position Within A Datagrid After Postback

I have an aspx page containing a datagrid. This datagrid is populated in the code-behind via a SQL query and can have anywhere from 1 to 1000 rows. Users can click on each row and

Solution 1:

Can you wrap the datagrid in an UpdatePanel?

Solution 2:

After beating my head against the wall for hours, I finally figured it out.

The code posted above is correct and works perfectly. The problem was that divDataGrid was contained within another div, and THAT div had overflow:auto set. So the scroll bar I was seeing was from that div, not divDataGrid or grdItem.

Once I removed the overflow:auto setting from the previous div everything started working.

Post a Comment for "Asp.net How To Maintain Scroll Position Within A Datagrid After Postback"