User-511826081 posted
Hello folks,
Initialisation of ButtonField
I have a code which perfectly working:
ButtonField ORDER_NO = new ButtonField();
ORDER_NO.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
ORDER_NO.ButtonType = ButtonType.Link;
ORDER_NO.Visible = true;
A need to make it a bit shorter:
ButtonField ORDER_NO = new ButtonField() {
ItemStyle.HorizontalAlign = HorizontalAlign.Center,
ButtonType = ButtonType.Link,
Visible = true;
};
this code are failed on compilation of
ItemStyle.HorizontalAlign = HorizontalAlign.Center,
with Error CS0747 Invalid initializer member declarator
Did anybody have an idea what is wrong and how to get it compilable?
Control already inherited and in constructor initialisation are done.
But I still like to known why direct approach didn't work.