Quantcast
Channel: Silverlight Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 801

Commented Issue: Dataform converts null string to String.Empty [10576]

$
0
0
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 **

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;
}
}


Viewing all articles
Browse latest Browse all 801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>