error message and help text don't show

7 posts, 1 answers
  1. Tino
    Tino avatar
    86 posts
    Member since:
    Jul 2017

    Posted 24 Oct 2017 Link to this post

    Unfortunately I'm using an older version of the winforms controls, but just in case someone can help..

    I'm validating in the property view, but I can't get an error message to show. I even tried to set Description until I worked out the error message issue, but that doesn't show either. (I have the help panel showing).

    I have a delegate doing the property validation, which returns me an error string if invalid. The string is being returned correctly. See below for my code; I've only changed a name or two.

    private void OnValidating(object sender, PropertyValidatingEventArgs e)
    {
        var item = e.Item as PropertyGridItem;
        if (item == null) return;
     
        if (_validateProperty != null)
        {
            var item = GetViewModelItem(sender);
            var error = "";
            var valid = _validateProperty(item, e.Item.Name, e.NewValue as string, out error);
            if (!valid)
            {
                // TODO: error message not showing
                item.ErrorMessage = error;
            }
            e.Cancel = !valid;
        }
    }
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    2789 posts

    Posted 25 Oct 2017 Link to this post

    Hi Tino,

    Could you specify the exact version number that you are using?

    Please note that the description is displayed in the help panel. The error message is shown when you are hovering the red exclamation mark. I have attached a small project that shows how this works.

    I am looking forward to your reply.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Tino
    Tino avatar
    86 posts
    Member since:
    Jul 2017

    Posted 05 Dec 2017 in reply to Dimitar Link to this post

    Seems to be 2017.3.912.40

  4. Dimitar
    Admin
    Dimitar avatar
    2789 posts

    Posted 06 Dec 2017 Link to this post

    Hi Tino,

    I have tested it with this version and it appears to work correctly on my side (see attached video). Could you please let me know what I need to change in the test project in order to reproduce the undesired behavior? Or perhaps you want to achieve something else?

    I am looking forward to your reply.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Tino
    Tino avatar
    86 posts
    Member since:
    Jul 2017

    Posted 11 Dec 2017 Link to this post

    I found something that fixed it. I had ShowItemToolTips set to False on my PropertyGrid control. I set it to True and can see the message.

    However, I don't get the message appearing in the help area, it appears as a tooltip, like in the documentation. This is actually my preference, so that's fine, but I'm not sure why yours is different. The only problem is that the user must hover over a very small area, the "!" character, to see the message.

    I also tried a fresh project similar to yours, and I still get the message as a tooltip.

    A sample project would've been good too.

  6. Dimitar
    Admin
    Dimitar avatar
    2789 posts

    Posted 12 Dec 2017 Link to this post

    Hi Tino,

    This is the default behavior and the error message is displayed in the tooltip. The help panel displays the string from the description attribute. You can use the following approach in order to increase the area where the tooltip appears:
    private void RadPropertyGrid1_ToolTipTextNeeded(object sender, Telerik.WinControls.ToolTipTextNeededEventArgs e)
    {
        var item = sender as PropertyGridItemElement;
     
        if (item != null)
        {
            var data = item.Data as PropertyGridItem;
            if (data.ErrorMessage != null)
            {
                 e.ToolTipText = data.ErrorMessage;
            }
        }
    }

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. Tino
    Tino avatar
    86 posts
    Member since:
    Jul 2017

    Posted 12 Dec 2017 in reply to Dimitar Link to this post

    You're right, I got my wires crossed there. Thanks for the help and I think you've answered everything now.
Back to Top