Dataform 4.0.5.0
If I got readOnly string field that contains null, dataform tries to set this value String.Empty. As this field is readOnly it fails validation. I cannot edit this entry.
Currently the problem is that because of this in my database some fields are string.Empty some NULL. And I cannot use this workaround: http://blog.ondrejsv.com/post/Silverlight-DataForme28099s-autogenerated-fields-send-empty-strings-to-database.aspx
Comments: ** Comment from web user: Aurimas86 **
If I got readOnly string field that contains null, dataform tries to set this value String.Empty. As this field is readOnly it fails validation. I cannot edit this entry.
Currently the problem is that because of this in my database some fields are string.Empty some NULL. And I cannot use this workaround: http://blog.ondrejsv.com/post/Silverlight-DataForme28099s-autogenerated-fields-send-empty-strings-to-database.aspx
Comments: ** Comment from web user: Aurimas86 **
Workaround:
On AutoGeneratingField add converter to field binding
public class DataFormStringEmptyBugConverter : IValueConverter
{
private object originalValue;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
originalValue = value;
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (targetType != typeof(string))
{
return value;
}
if (string.IsNullOrEmpty((string)value))
{
return originalValue;
}
return value;
}
}