e.Order in Dataform_AutoGeneratingField

2 posts, 0 answers
  1. Maurizio
    Maurizio avatar
    45 posts
    Member since:
    Jan 2012

    Posted 29 Mar 2012 Link to this post


    My business object properties have a attribute DisplayIndex and I want to set the order of my datafields to this displayindex.

    DisplayIndexAttribute displayIndexAtt;
     if (property.TryGetAttribute<DisplayIndexAttribute>(out displayIndexAtt))
                    e.Order = displayIndexAtt.index;

    This is working fine. But the problem is that not all properties have the displayindex attribute, so for some properties e.Order is null. I expected that these properties are displayed at the end of the dataform, but instead they are at the beginning.

    Is there a way to change this behavior in the way that the properties without an explicit order will be at the end of the Dataform?
  2. Pavel Pavlov
    Pavel Pavlov avatar
    2039 posts

    Posted 29 Mar 2012 Link to this post

    Hi Thomas,

    I believe the only way to do this is to iterate over the elements and assign a large number(exceeding the max possible count of fields )  to those whose initial value is null.

    Pavel Pavlov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top