CommandField ImageButtons to Render side by side

246 views Asked by At

Cannot make Update and Cancel ImageButtons to render side by side in a GridView, they are always stacked on top of each other in this Edit CommandField no matter how wide I make the column:

<asp:CommandField ButtonType="Image" ShowEditButton="true" HeaderText="Edit" EditImageUrl="~/i/BlueButton.jpg" ControlStyle-CssClass="center-block"
    CancelImageUrl="~/i/Cancel.jpg" UpdateImageUrl="~/i/Update.jpg" >
    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Height="25px" Width="100px" />
</asp:CommandField>

I tried many approaches in vain; for example, wrapping the commandfield in a div - failed, probably because I tried to do it inside the GridView; could not find a combination of alignment specifications that would work.

1

There are 1 answers

0
r4r4 On

Thank you, Martin! Solved simply by dropping ControlStyle-CssClass="center-block". Centering the controls is taken care of in ItemStyle.