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 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. |