Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi everybody,
Is it possible to freeze a few columns of a gridview using only CSS. If yes, please help me with the way to do it. FYI, I have added the columns programatically using c# and the grid contains bound fields as well as template fields. This grid is implemented in sharepoint 2010. Please reply asap.

Thanks & Regards,
Srivikas.
Posted

CSS
div#topdiv {
    position:fixed;
    top:0px;
    left:0px;
    width:100%;
    color:#CCC;
    background:#333;
    padding:8px;
}
div#bottomdiv {
    position:fixed;
    bottom:0px;
    left:0px;
    width:100%;
    color:#CCC;
    background:#333;
    padding:8px;
}
 
Share this answer
 
 
Share this answer
 
What actually you want friend, I mean collapsible and openable row in grid view or something else, if yes then it will be a bit difficult, I have faced the same problem before 5 months ago, and my lead advised me to use list view for achieving this functionality, and I did it using jQuery.
 
Share this answer
 
Comments
Srivikas 15-Nov-12 12:23pm    
Hi.. Thank u for your response. The grid I am going to use is very wide. i.e it has more number of columns. It is impossible to view all at a time in the window without scrolling. But the first two column are to be visible every time to understand the other details. SO i want to make them fixed and make the other columns scrollable.Have you got my point now? Waiting for your reply...

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900