Intersoft WebGrid Documentation
How-to: Use CustomConditionText in FormatConditions
See Also Send comments on this topic.

Glossary Item Box

Previously, you learn how to create a format condition. However, you can create a custom condition text to apply in FormatConditions.

In this topic, you will learn how to create FormatConditions in specific row and cell using table Customers from NorthWind database.

To use CustomFormatConditions in FormatConditions

 Add InitializeLayout server side event:

C# Copy ImageCopy Code
using ISNet.WebUI.WebGrid;

private void WebGrid1_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e)
{     
   WebGridFormatCondition a = new WebGridFormatCondition();     
   a.Name = "Format3";      
   a.CustomConditionText = "[ContactName] like 'a%' and [ContactTitle] like 'Sales%'";     
   a.FormatStyle.Font.Italic = true;     
   a.TargetObject = ISNet.WebUI.WebGrid.TargetObjectType.Row;          

   WebGrid1.RootTable.FormatConditions.Add(a);
}

Please note that if you are using RetrieveStructure, then you need to put the above codes in PrepareDataBinding.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.