Hi All
How do I default a DatePicker to the current data/time? Its under an "add" crud page so the default "Value" is ${noteshistory.dt} (which doesn't make sense as it would not exist yet) I'd like to make this current d/t.
Thanks!
Hi All
How do I default a DatePicker to the current data/time? Its under an "add" crud page so the default "Value" is ${noteshistory.dt} (which doesn't make sense as it would not exist yet) I'd like to make this current d/t.
Thanks!
It actually makes a lot of sense to set the Value property of Input components (such as a DatePicker) to a property of your model. This makes sure that:
More info about components and properties can be found in the Fundamentals section of Radzen's documentation.
Setting default values is quite simple as @Vinod_Pillai has shown - just assign the property you want to the value you want after the model is instantiated.
Hi @Vinod_Pillai , @korchev
I have set the Value property to DateTime.Now but am getting the incorrect date
Any suggestions?
Check again @Vinod_Pillai 's response. Do not assign the Value property of the component directly to DateTime.Now as it will no longer update the model property. Make sure to check the Fundamentals help article which shows how to get user input and explains how the Value property of input components work.
ok thanks for your pateient, i have done exactly as suggested and its populating the field.
I have the DateFormat as yyyy-MM-dd but the text box is showing the time
How can I exclude the time ?
You can set date format using DateFormat property of the control ex: shown here
Hi
I have already set the DateFormat to yyyy-MM-dd, doing DateTime.Now.Date returns 00:00:00 as the time now.
Time still showing despite the DateFormat, not sure why, will live with it...