Cannot exit InPlace editor

3 posts, 1 answers
  1. Raulis
    Raulis avatar
    16 posts
    Member since:
    Jun 2016

    Posted 06 Sep 2016 Link to this post

    I've been trying to implement a RegularExpressionValidator for a textbox in my RadGrid. Edits and Inserts happen using the InPlace editor. They are not automatic, I deal with them via code. If I go into Edit Mode I cannot exit Edit Mode or do anything until I fill in the empty fields in the InPlace Editor and either use the Insert or Cancel command. Using the debugger I've determined that no postbacks happen while the grid is in edit mode and there are empty fields in the inplace editor. Not quite sure what to do, cannot find similar issues in the forums.


    This is my OnDataBound event that implements the RegularExpressionValidator:


                'if the grid is currently being edited
                If e.Item.IsInEditMode Then

                    Dim eItem = TryCast(e.Item, GridEditableItem)
                    Dim editor = TryCast(eItem.EditManager.GetColumnEditor("rate"), GridTextBoxColumnEditor)
                    Dim cell = TryCast(editor.TextBoxControl.Parent, TableCell)
                    Dim rev = New RegularExpressionValidator()
                    rev.ControlToValidate = editor.TextBoxControl.ID
                    rev.ValidationExpression = "[0-9]*\.?[0-9]*"
                    rev.CssClass = "text-danger"
                    rev.ErrorMessage = " Please provide a valid number."
                End If



    My Cancel command (which does not get executed):





    ToggleCommandColumns is a custom function that swaps button visibility so it should not be affecting anything. Same goes for ToggleControlVisability, it just makes some controls visible on the page. 

    I only started encountering this issue when I put in a RegularExpressionValidator. If I take it out, it works fine (I can cancel the editor at any time).

    Any support would be appreciated. 

  2. Answer
    Viktor Tachev
    Viktor Tachev avatar
    2495 posts

    Posted 09 Sep 2016 Link to this post

    Hello Raulis,

    The behavior you are seeing is likely caused by the validators. If the entered values are not valid the validator will prevent postback.

    In order to avoid that you can use ValidationGroups. Set one group for the RegularExpressionValidator and the Update/Insert button. For the Cancel button you can set the CausesValidation property to false.

    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. Raulis
    Raulis avatar
    16 posts
    Member since:
    Jun 2016

    Posted 09 Sep 2016 in reply to Viktor Tachev Link to this post

    Perfect, exactly what I needed. The thought of changing the "CausesValidation" value just skimmed past my head. Everything's working as intended now, thanks again.
Back to Top