Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
495
Auto-generate fields just for an interface
posted

Hi

My class A implements interface IB. For my grid I would like to auto-generate fields for IB only (instead of using other public properties from A). Is this possible?

Thanks!

Parents
No Data
Reply
  • 9836
    posted

    Yes, you can apply the [Browsable(false)] attribute on the properties that you want to disable or handle the FieldLayoutInitialized event and change the visibility of the Fields.

    public class Employee : IEmployee

        {

            private string firstName;

            private string lastName;

     

            public string FirstName

            {

                get

                {

                    return firstName;

                }

                set

                {

                    firstName = value;

                }

            }

     

            [Browsable(false)]

            public string LastName

            {

                get

                {

                    return lastName;

                }

                set

                {

                    lastName = value;

                }

            }

        }

    interface IEmployee

        {

            string FirstName

            {

                get;

                set;

            }

            string LastName

            {

                get;

                set;

            }

        }

     

Children