GrapeCity.Win.MultiRow Namespace > Cell Class : ErrorText Property |
<BrowsableAttribute(False)> <DefaultValueAttribute()> Public Property ErrorText As String
[Browsable(false)] [DefaultValue()] public string ErrorText {get; set;}
void gcMultiRow1_CellValidating(object sender, CellValidatingEventArgs e) { if (e.CellName == "Age") { int age = int.Parse(e.FormattedValue.ToString()); if (age < 0 || age > 100) { e.Cancel = true; // Set error text to why the cell validating failed. this.gcMultiRow1[e.RowIndex, e.CellIndex].ErrorText = "The age should be greater than 0 and less than 100."; this.gcMultiRow1.EndEdit(); } else { this.gcMultiRow1[e.RowIndex, e.CellIndex].ErrorText = string.Empty; } } }
Private Sub gcMultiRow1_CellValidating(ByVal sender As Object, ByVal e As CellValidatingEventArgs) Handles gcMultiRow1.CellValidating If e.CellName = "Age" Then Dim age As Integer = Integer.Parse(e.FormattedValue.ToString()) If age < 0 OrElse age > 100 Then e.Cancel = True ' Set error text to why the cell validating failed. Me.gcMultiRow1(e.RowIndex, e.CellIndex).ErrorText = "The age should greater than 0 and less than 100." Me.gcMultiRow1.EndEdit() Else Me.gcMultiRow1(e.RowIndex, e.CellIndex).ErrorText = String.Empty End If End If End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2