MultiRow Windows Forms > Developer's Guide > Using MultiRow > User Input Validation > Built-in Validation Actions > Notification using CellStyle (CellStyleNotify) |
You can use the CellStyleNotify object to change the cell style to notify users of a validation error. For example, you can change the background color or foreground color of the cell to red.
Use the following steps to use CellStyleNotify for notification.
The following code changes the background color of a cell to indicate a validation error when the textBoxCell is blank.
Imports GrapeCity.Win.MultiRow Dim textBoxCell1 As New TextBoxCell() Dim requiredFieldValidator1 As New RequiredFieldValidator() Dim cellStyleNotify1 As New CellStyleNotify() cellStyleNotify1.InvalidCellStyle.BackColor = Color.Red requiredFieldValidator1.Actions.Add(cellStyleNotify1) textBoxCell1.Validators.Add(requiredFieldValidator1) Dim cells As Cell() = {textBoxCell1} GcMultiRow1.Template = Template.CreateGridTemplate(cells) GcMultiRow1.RowCount = 10 |
using GrapeCity.Win.MultiRow; TextBoxCell textBoxCell1 = new TextBoxCell(); RequiredFieldValidator requiredFieldValidator1 = new RequiredFieldValidator(); CellStyleNotify cellStyleNotify1 = new CellStyleNotify(); cellStyleNotify1.InvalidCellStyle.BackColor = Color.Red; requiredFieldValidator1.Actions.Add(tipNotify1); textBoxCell1.Validators.Add(requiredFieldValidator1); Cell[] cells = { textBoxCell1 }; gcMultiRow1.Template = Template.CreateGridTemplate(cells); gcMultiRow1.RowCount = 10; |