Earn Cash from forex trading and free 5$ for Regiatation.

Monday, June 1, 2009

How to have FilterRow functionality in the UltraWebGrid when handling its server-side Click event



When trying to use the UltraWebGrid’s FilterRow functionality, if you are handling its server-side Click event, you will not get the functionality you expect. When a cell in the FilterRow is clicked, the grid posts back, the cell loses focus, and the FilterRow drop down never appears. The way around this is to handle the client-side click event for the grid and cancel the postback if a cell in the filter row is clicked.
Additional Information

First set the UltraWebGrid’s AllowRowFiltering property to OnClient and its FilterUIType property to FilterRow.
In C#:
UltraWebGrid1.DisplayLayout.Bands[0].FilterOptions.AllowRowFiltering = Infragistics.WebUI.UltraWebGrid.RowFiltering.OnClient;
UltraWebGrid1.DisplayLayout.Bands[0].FilterOptions.FilterUIType = Infragistics.WebUI.UltraWebGrid.FilterUIType.FilterRow;

In VB.Net:
UltraWebGrid1.DisplayLayout.Bands(0).FilterOptions.AllowRowFiltering = Infragistics.WebUI.UltraWebGrid.RowFiltering.OnClient
UltraWebGrid1.DisplayLayout.Bands(0).FilterOptions.FilterUIType = Infragistics.WebUI.UltraWebGrid.FilterUIType.FilterRow

A DataKey must be set so that the UltraWebGrid can distinguish between the FilterRow and a regular GridRow:
In C#:
UltraWebGrid1.DataKeyField = "CustomerID";

In VB.Net:
UltraWebGrid1.DataKeyField = "CustomerID"

Add a client-side handler for the UltraWebGrid’s CellClick event and check for a DataKey to allow postback:
In Javascript:
function UltraWebGrid1_CellClickHandler(gridName, cellId, button){
var rowObj = igtbl_getRowById(cellId);
if( rowObj != null )
{
if( rowObj.getDataKey() == null )
{
igtbl_cancelPostBack(rowObj.gridId)
}
}
}

1 comments:

Anonymous said...

hello... hapi blogging... have a nice day! just visiting here....