ErrorText being set doesn't trigger the messagebox

3 posts, 1 answers
  1. Ioannis
    Ioannis avatar
    35 posts
    Member since:
    Dec 2018

    Posted 31 Jan 2019 Link to this post

    I'm following the example of "" to do some data validation and I'm expecting it to show an error message when the user inputs a non-validated string in the cell, like it's shown in the telerik docs, however even though I can see with the debugger that the .ErrorText property is set, a message is not shown (but e.Cancel works and the focus remains on the problematic cell)

    I could call a msgbox() to show the message, but I feel that negates the purpose of setting the .ErrorText property. What am I doing wrong?

    Information on the Code block:

    AbsenceString = "U". SicknessString = "K". gvTimesheet's ShowCellErrors is set to TRUE on the Designer.

    Private Sub gvTimesheet_CellValidating(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellValidatingEventArgs) Handles gvTimesheet.CellValidating
        If e IsNot Nothing AndAlso e.Value IsNot Nothing Then
            Dim column As GridViewDataColumn = TryCast(e.Column, GridViewDataColumn)
            If TypeOf e.Row Is GridViewDataRowInfo AndAlso column IsNot Nothing AndAlso column.Index >= 5 Then
                Dim AbsenceOrIllnessMatch As Match = Regex.Match(DirectCast(e.Value, String), "[" & AbsenceString.ToLower & AbsenceString.ToUpper & SicknessString.ToLower & SicknessString.ToUpper & "]{1}\d+")
                If DirectCast(e.Value, String) <> "" AndAlso Not IsNumeric(DirectCast(e.Value, String)) AndAlso Not AbsenceOrIllnessMatch.Success Then
                    e.Cancel = True
                    DirectCast(e.Row, GridViewDataRowInfo).ErrorText = sa("The hours-worked values can only be numeric, with optional letters {0} or {1} preceding the numeric part to indicate absence hours or illness hours respectively.", AbsenceString, SicknessString)
                    DirectCast(e.Row, GridViewDataRowInfo).ErrorText = String.Empty
                End If
            End If
        End If
    End Sub



  2. Answer
    Hristo avatar
    1520 posts

    Posted 01 Feb 2019 Link to this post

    Hi Ioannis,

    Thank you for writing back.

    Setting the ErrorText property will not automatically display a message box, rather it will add the error icon at the beginning of the row and message will be shown as a tooltip. Of course, you can also display a message box to the end user.

    Let me know if you have other questions.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Ioannis
    Ioannis avatar
    35 posts
    Member since:
    Dec 2018

    Posted 01 Feb 2019 in reply to Hristo Link to this post

    Oh, I see. I hadn't noticed that.


    Thank you, that answers my question :)


Back to Top