I had a problem that I just could not understand why it would not work.
I use enums at times to populate dropdowns. For an example
[DataContract]
[Serializable]
public enum Corporate
{
[EnumMember] [Description("FD")] COMPANY,
[EnumMember] [Description("IB")] INDUSTRY,
[EnumMember] [Description("KD")] PRIVATE,
[EnumMember] [Description("SLE")] SLEIPNER
}
I want Company, Private etc to be populated in the dropdown and then get the description value back.
Well, this has nothing to do with Telerik so far. My problem was when in my datacontract I was using nullable
and wanted to use filter in my RadGrid. It would not work. I debugged my could and
found that the FilterExpression was set to "([Corporate] = INDUSTRY)". Now, this is just plain wrong.
It should be "([Corporate] = 'INDUSTRY')". Note the single quotation marks.
I fixed this issue by adding DataType="System.String" and then the filtering looked ok, but nope
it still did not work.
Why did it not work?
Well, it turned out that when I was using
[DataMember]
public Corporate Corporate { get; set; }
in my contract it works, but when using a nullable property
[DataMember]
public Corporate? Corporate { get; set; }
it did not work.
I fixed it by adding another class called searchcriteria and use that one
for my initial search containing my nullable Corporate and then my original class without nullable
for the filtering. This is very irritating. Can someone at Telerik look into this matter.
Best regards,
Claes