In this topic, you will learn how to create FormatConditions in specific row and cell using table Customers from NorthWind database.
To create FormatConditions in a specific row and cell
Add InitializeLayout server side event:
C# | Copy Code |
using ISNet.WebUI.WebGrid; private void WebGrid1_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e) { //specific row WebGridFormatCondition a = new WebGridFormatCondition(); a.ColumnMember = "Country"; a.ConditionText = "UK"; a.Name = "Format1"; a.FormatStyle.ForeColor = Color.Red; a.TargetObject = ISNet.WebUI.WebGrid.TargetObjectType.Row; //specific Cell WebGridFormatCondition b = new WebGridFormatCondition(); b.ColumnMember = "City"; b.ConditionText = "Madrid"; b.Name = "Format2"; b.TargetColumnMember = "City"; b.FormatStyle.Font.Bold = true; b.TargetObject = ISNet.WebUI.WebGrid.TargetObjectType.Cell; WebGrid1.RootTable.FormatConditions.Add(a); WebGrid1.RootTable.FormatConditions.Add(b); } |
Please note that if you are using RetrieveStructure, then you need to put the above codes in PrepareDataBinding. |
Tasks
How-to: Use CustomConditionText in FormatConditions
Other Resources
Walkthrough Topics
How-to Topics