How can i freeze initial 2 -3 leftmost column in asp.net grid view? so that while horizontal scrolling initial 2 – 3 columns that got freezes will always be display.
Any answers??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it seems to be possible with some css magic, with the pinned and scrollable columns on different z-indexes to keep the pinned on top. This comes with the caveat that
overflow:scrollmay not be 100% portable (I’ve tested on IE 8/9 and Chrome FWIW).Take a look at this jsFiddle here
The ASPX I used to generate the
GridViewis below.Note the css classes
pinnedandscrollablefor fixed and scrolling columns respectively (applied to headers and items)But the real work is done in the css. Note especially that you need to fiddle to get your column widths correct to align the fixed td’s / th’s at the left.
aspx
css