PRB:WebGrid column headers do not align with their columns in NetAdvantage for .NET 2007 Volume 3

PRB:WebGrid column headers do not align with their columns in NetAdvantage for .NET 2007 Volume 3


The information in this article applies to:
UltraWebGrid (v7.3.20073)
  Article Created: 
10/10/2007

Last Updated:
11/2/2007

Article Type
Problem
  
Page Options
Average Rating:
5 out of 10

Rate this page
Print this page
E-mail this page
Add to Favorites

Summary

In the release build of 7.3, there is an issue of misaligned column headers and columns within the grid due to resizing and hiding columns on the server.

Additional Information

Note: If you downloaded NetAdvantage for .Net 2007 Volume 3 after October 23, 2007, you should not be encountering this problem.

If you are implementing code similar to the code below, you may experience some problems with the alignment of your column headers.

In VB.NET:

e.Layout.Bands(0).Columns.FromKey("Column_1").Hidden = True
e.Layout.Bands(0).Columns.FromKey("Column_2").Width = Unit.Pixel(200)

In C#:

e.Layout.Bands[0].Columns.FromKey("Column_1").Hidden = true;
e.Layout.Bands[0].Columns.FromKey("Column_2").Width = Unit.Pixel(200);

Step-By-Step Example

An easy work around for this issue is to set the width of the columns via javascript in the UltraWebGrids InitializeLayoutHandler client side event.

To handle the client side event, follow the steps below.
1). Click on the grid to bring up the properties window.
2). Navigate to DisplayLayout -> ClientSideEvents-> InitializeLayoutHandler.
3). Right click the dropdown next to the InitializeLayoutHandler and choose “Add New Handler”
4). Then click okay in the dialogue that comes up which will automatically create the client side hander based on the name of your grid and the handler chosen. A script block will also be created if one does not already exist.

Once you have the event handled, you will need to set the width of any columns that you set the width for via server side code.

In JavaScript

function UltraWebGrid1_InitializeLayoutHandler(gridName)
{
    //obtain the grid object
    var grid = igtbl_getGridById(gridName);

    //For each column in server side code that you set the width for, you will have to
    //set it here. If you were using the column key to access your columns on the
    //server, all you will have to do is replace “Column_2” with the key of your
    //column and change the width accordingly.
    grid.Bands[0].getColumnFromKey("Column_2").setWidth(200);    

    //if you want to set the width by index, you can do the following:
    //grid.Bands[0].Columns[1].setWidth(200);
}

Another possible workaround is to re-download and install the NetAdvantage for .Net 2007 Volume 3 release build. When this issue was fixed, the fix was incorporated into the release build and new installers were created and posted, replacing the old ones. So all you need to do is re-download NetAdvantage for .Net 2007 Volume 3 and run the new installer. You should not need to un-install the current version of NetAdvantage for .Net 2007 Volume 3.

posted @ 2008-01-11 20:37  行进中开火  阅读(442)  评论(0编辑  收藏  举报