How do I freeze a column from scrolling with the rest of the data. I want to display a grid with the last columns always visible. The rest of the data must scroll left or right without the last columns moving.
Thank you
You can do this with Fixed headers. Set UseFixedHeaders to true and then set the Fixed property on the column header(s) you want to fix. I would do all of this in the InitializeLayout event of the grid.
thanks
Let me repharase my question.
I am calling Ultragrid1.datasource = datatable in the form load event. The datatable contains 21 cols which are dynamically bind to data grid. Now in InitializeLayout of UltraGrid i am freezing first 5 columns as below.
e.Layout.UserFixedHeader=true;
for(int i=0;i<5;i++)
{
e.Layout.Band[0].columns.Header.Fixed=true;
}
The Good thing is first 5 cols are Freezed now. I have also one dropdown box which contain 3 values. Each value changes the datasource of UltraGrid on SelectedValueChange Event. So when i change the datasource property to the new values in datatable. the order of the cols also changes.
Note: The datatable contains the same cols with exact name and order only value is different.
The strange thing is if i comment out the above loop for freezing 5 cols, it works perfectly fine.
Instead of setting the DataSource property on the grid, try calling SetDataBinding, instead and see if that helps.
If not, it sounds like a bug in the grid. The grid must be doing something in the wrong order when binding the new columns in the data source with the existing columns in the grid. You should try to duplicate this in a small sample project and Submit an incident to Infragistics Developer Support.
In the mean time, you can try working around it by either explicitly setting the VisiblePosition on each column header as I mentioned before. Or, try saving the grid's layout (using grid.Layout.Save) before you set the DataSource, then re-load the layout afterward.
What code needs to be used to freeze columns within an ultrawebgrid?
mhornby said:What code needs to be used to freeze columns within an ultrawebgrid?
You should post this question in the UltraWebGrid forum.
Thanks.