Column Locking / Freezing in Infragistics Ultra WebGrid

(NetAdvantage for ASP.NET)

If you want to freeze first few columns like EXCEL and horizontally scroll rest of the columns in Ultra WebGrid here you go…

Event :

UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)

VB Code :

[sourcecode language=’vb’]
e.Layout.UseFixedHeaders = true
e.Layout.Bands(0).Columns(1).Header.Fixed = true
e.Layout.Bands(0).Columns(2).Header.Fixed = true
[/sourcecode]

Above code freezes the  two columns (second,third) in Grid.

C# Code

[sourcecode language=’csharp’]
protected void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
{

e.Layout.UseFixedHeaders = true;
e.Layout.Bands[0].Columns[1].Header.Fixed = true;
e.Layout.Bands[0].Columns[2].Header.Fixed = true;

}
[/sourcecode]

5 thoughts on “Column Locking / Freezing in Infragistics Ultra WebGrid

  • January 16, 2008 at 11:15 am
    Permalink

    That didnot work. I searched Infragistics website and found this working..just two lines of code..amazing..

    using Infragistics.WebUI.UltraWebGrid;
    this.UltraWebGrid1.DisplayLayout.StationaryMargins = StationaryMargins.Header;

    Reply
  • February 1, 2008 at 12:36 pm
    Permalink

    I find that both the article code works and Sairam’s code works. However, the former is for preventing columns from scrolling going right to left, while the latter if for preventing column headers from scrolling top to bottom, if that makes sense…

    Reply
  • February 1, 2008 at 4:45 pm
    Permalink

    Is there any way to fix a row so that the first row is frozen and you can scroll the remaining rows vertically?

    Reply
  • February 8, 2008 at 5:30 am
    Permalink

    thd above code works fine for freezing columns and headers of the hierarchical webgrid. But its changing the column index of the 3rd band of that hierarchical grid. changing column index means, after getting data from database am binding that to the grid and while retrieving those values from webgrid the column index getting change. please reply me back , its urgent.

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: