# DatePicker DateFormat data binding error

**URL:** <https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985>\
**Category:** Blazor Server\
**Created:** [December 10, 2020, 7:14pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985 "2020-12-10T19:14:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [December 10, 2020, 7:14pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/1 "2020-12-10T19:14:17Z")

</div>

Hello Radzen Team!

I'm binding the DateFormat property to a static class method, returning the correct format according to the user preferred language. The designer shows an error but everything works as expected in runtime:

 ![image](https://forum.radzen.com/uploads/default/original/2X/3/39ec48612dbda8692d7fea9728d29a956f819119.png)  
 ![image](https://forum.radzen.com/uploads/default/original/2X/f/fe43a6edd0986e036b9ee4d97e6b9f0065931489.png)  
 ![image](https://forum.radzen.com/uploads/default/original/2X/7/75bda55507310ace7617012998ecdbb6337384c7.png)

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [December 10, 2020, 7:54pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/2 "2020-12-10T19:54:03Z")

</div>

If you send us a sample project we could try reproducing this. Other than that I can suggest using a page property for the format instead of the service directly.

---

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [December 10, 2020, 7:58pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/3 "2020-12-10T19:58:09Z")

</div>

Thanks for the idea, I will use a page property for now.

I forgot to tell that the DatePicker is inside a template that is inside a Tabs component, and from the outside it also shows the same error:

 ![image](https://forum.radzen.com/uploads/default/original/2X/1/1a8fd78467cf1e5b01978f015297d31fa038c95f.png)

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [December 10, 2020, 8:10pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/4 "2020-12-10T20:10:29Z")

</div>

Does the Language service work anywhere in design time?

---

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [December 10, 2020, 8:21pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/5 "2020-12-10T20:21:41Z")

</div>

Pretty much everywhere. It contains the string tables and some other language oriented content.

 ![image](https://forum.radzen.com/uploads/default/original/2X/4/420caacb8450b709025e9004df2f4dc635ea618a.png)

In this form there are a dozen references to the Language service. Here's an example:

 ![image](https://forum.radzen.com/uploads/default/original/2X/3/3a87f23d477e9f03e122c01f35927ad57d5c67b3.png)

Also in the same template inside the DataList right on the side of the DatePickers:

 ![image](https://forum.radzen.com/uploads/default/original/2X/0/09253abd1996dd5cc862513cbc181f8276eb96b5.png)

I think it's something specific to this method, because I tried other method from the LanguageService in the DatePicker and it worked. I'll post both codes for further testing:

```auto
        public string GetDateFormat() {
            return DateFormats.FirstOrDefault(x => x.id == Language)?.value ?? "dd/MM/yyyy";
        }
```

```auto
        public string GetText(EN_Text text, bool toLower = false) {
            string result = Texts.FirstOrDefault(x => x.id == (int)text && x.language == Language)?.value ?? "{}";
            return toLower ? result.ToLower() : result;
        }
```

---

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [December 10, 2020, 8:25pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/6 "2020-12-10T20:25:23Z")

</div>

OK, so the same method with a parameter works:

```auto
        public string GetDateFormat(EN_Text test) {
            return DateFormats.FirstOrDefault(x => x.id == Language)?.value ?? "dd/MM/yyyy";
        }
```

 ![image](https://forum.radzen.com/uploads/default/original/2X/0/062c3007a6a03c1ce3dde40e1ce782788ccea7c4.png)

Radzen recognizes the method in the class:  
 ![image](https://forum.radzen.com/uploads/default/original/2X/d/dd41b79f58a77d86a2dcf8b59cb72f0e029d1f63.png)

---

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [December 10, 2020, 8:28pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/7 "2020-12-10T20:28:09Z")

</div>

This is not specific to the DatePicker component. This parameterless method makes any component  
throws an error in the designer no matter where I put it.

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [December 11, 2020, 9:18am UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/8 "2020-12-11T09:18:04Z")

</div>

I will investigate if it is possible to handle such cases.

---

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [December 14, 2020, 3:19pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/9 "2020-12-14T15:19:37Z")

</div>

I see attempts to fix this issue were addressed in 2.56.4. Indeed my original problem is fixed, but many others (basically all from the Language methods that have a parameter) were created:

 ![image](https://forum.radzen.com/uploads/default/original/2X/1/13955ae0f9167f0b4af820ffb8608a949c839e80.png)  
 ![image](https://forum.radzen.com/uploads/default/original/2X/6/6e8e25bb5f54e23e67c8578596363041840c60ef.png)

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [December 14, 2020, 3:32pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/10 "2020-12-14T15:32:34Z")

</div>

It seems to be this issue: [Designer looks weird after update to 2.56.4](http://forum.radzen.com/t/designer-looks-weird-after-update-to-2-56-4/6009/2)

We have fixed it but the fix isn't released yet. You can use the 2.56.3 until we release it.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [December 14, 2020, 3:58pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/11 "2020-12-14T15:58:00Z")

</div>

@kim you can get the latest build for Windows from [here](https://drive.google.com/file/d/1tN6cpjPL_8HUd2VOQ5b-eDl-hS-px9yC/view?usp=sharing).

---

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [December 14, 2020, 4:14pm UTC](https://forum.radzen.com/t/datepicker-dateformat-data-binding-error/5985/12 "2020-12-14T16:14:26Z")

</div>

@enchev @korchev flawless support as always! Thank you very much.

 ![image](https://forum.radzen.com/uploads/default/original/2X/2/2c7fc59a500eb970a042cb434859dff344f69283.png)
