This is a migrated thread and some comments may be shown as answers.

Best way to make some fields dynamically enabled/disabled?

4 Answers 120 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 27 Jul 2011, 05:22 AM
Firstly, thanks for adding this to the controls - I am working on a project that will have a LOT of property editing and this will be a huge part of the user experience - I love the group/sort, search and description features.

One issue I have though is that many of my objects have properties that are only meaningful if other properties have certain values - for example in a 'workitem' object, I have a field called 'AssignedTo' but it is not valid (and I would like to grey it out or hide it) if the workitem state is 'completed'.  Can you suggest the best way to go about this?

PS: any tips on tying this in with Annotations in RIA Services would be appreciated, though it looks like there's no built-in feature there yet.

4 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 27 Jul 2011, 09:16 AM
Hi David,

This could be achieved via bindings. You may place your own editor in the property grid field and bind its enabled state to a certain property. Please give me a small business object of yours and I will gather a small sample for you. Just let me know which property is to be edited and which one controls the enabled/disabled state.

All the best,
Pavel Pavlov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
David
Top achievements
Rank 1
answered on 07 Aug 2011, 12:34 AM
Well, even a contrived example will be fine, so let's use...

public

 

 

partial class workitem
{

private int id;

private string title;

private string description;

private int project_id;

private int assignee_id;

private int estimated_remaining_hours;

private DateTime estimated_eta;

private int status_id;

}

.. and please implement that 'estimated_remaining_hours' and 'estimated_eta fields' are only valid for certain values of status_id (this maps to statuses such as 'open issue', 'workitem completed' etc).

Greying out would be OK, but even better UI would be to hide irrelevant fields based on some of the parameters. Also it needs to be dynamic, since the user can change the workitem status as they edit the workitem.

Thanks!

 

0
Accepted
Pavel Pavlov
Telerik team
answered on 11 Aug 2011, 12:22 PM
Hello David,

Please find the sample attached . The DateTime field will be disabled when there is a status different from 1 entered in the status field.

Greetings,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
David
Top achievements
Rank 1
answered on 16 Aug 2011, 05:53 AM
Thanks - that was helpful!
Tags
PropertyGrid
Asked by
David
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
David
Top achievements
Rank 1
Share this question
or