Default values in editors within a form

1 Answer 451 Views
Form
Zack
Top achievements
Rank 1
Zack asked on 08 Nov 2021, 03:21 PM

Hi,

I have a form control (21 R3) that binds to a simple class and on some properties I want to use a dropdownlist as the editor.  This all works well other than I cannot set a default value?  The dropdownlist does not honour any default set on it when within a form.

Is it possible to set defaults, and will those defaults survive a form reset?

Thanks in advance,

Zack

 

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 11 Nov 2021, 07:36 AM

Hi, Zack,

When the Telerik UI DropDownList is bound to a specific C# object, then it would honor the value of the property of the object. The default value will be overridden. Would it be a problem if you set the default value directly in the C# instance of the class? This could happen by using a custom getter and setter for the property instead of the auto-generated ones.

 

Regards,
Tsvetomir
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Zack
Top achievements
Rank 1
commented on 11 Nov 2021, 08:45 AM

Hi Tsvetomir,

Sure that works I will go with that approach.

Thanks for the help.

Regards,

Zack

 

 

Tsvetomir
Telerik team
commented on 11 Nov 2021, 12:02 PM

I am happy to hear that the approach above is applicable to your scenario. I have found an article on StackOverflow that elaborates further on how exactly to set the value:

https://stackoverflow.com/questions/3071359/set-a-default-value-to-a-property/3071455

Tags
Form
Asked by
Zack
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or