views:

9

answers:

0

I am trying to implement ValidationException against a serialized DataMember of a class in a WCF web service. This datamember is of float type. I am getting the default data type validation messages, however the range validation that i had added is not working. Thanks for any input.

Following are the details -

Logic from WCF....

[DataContract]
[Serializable]
public class Packet_Details
{
    private float _responseP1;

    [DataMember]
    public string Node { set; get; }
    [DataMember]
    public float ResponseP1 
    { 
        set
        {
            if (value < 0 || value > 100 )
            {
                throw new ValidationException("Value should be between 0 & 100.");
            }
            _responseP1 = value;
        }
        get { return _responseP1; }
    }
 }

Logic from xaml.....

Logic from xaml.cs....

void ws_GetPacketDetailsCompleted(object sender, BEVDashBoard.ServiceReference1.GetPacketDetailsCompletedEventArgs e) { dgPacketDetails.ItemsSource = e.Result; _countPacket = e.Result.Count; }