在Gridview asp.net上并排编辑按钮

时间:2013-03-06 14:22:57

标签: c# asp.net gridview

我需要在我的gridview中显示更新和取消按钮,而不是在彼此之上

现在就是这样:

http://i.imgur.com/J53fCSi.png

我需要它像这样:

GreenButton RedButton

任何想法?

这是asp.net代码:

<asp:GridView runat="server" ID="CriteriosGridView" DataSourceID="dsCriterios" DataKeyNames="codigo"
        AutoGenerateColumns="False" CssClass="tabConfigGeral" HorizontalAlign="Center"
        BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
        CellPadding="3" OnDataBound="CriteriosGridView_DataBound">
        <Columns>
            <asp:BoundField DataField="codigo" HeaderText="Ordem" ItemStyle-HorizontalAlign="Center"
                InsertVisible="False" ReadOnly="True" SortExpression="codigo">
                <ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:BoundField>
            <asp:BoundField DataField="filtro" HeaderText="Critério" SortExpression="filtro"
                ItemStyle-Width="200px">
                <ItemStyle Width="200px"></ItemStyle>
            </asp:BoundField>
            <asp:CommandField ShowEditButton="True" HeaderText="Ação" CancelText="" EditText=""
                UpdateText="" Visible="False" ButtonType="Image" CancelImageUrl="~/Images/Cancel.png"
                EditImageUrl="~/Images/action.Edit.gif" UpdateImageUrl="~/Images/Logado.png">
                <ControlStyle Height="14px" Width="14px" />
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Height="22px" Width="22px"
                    CssClass="BotaoGrid"></ItemStyle>
            </asp:CommandField>
        </Columns>
        <FooterStyle BackColor="White" ForeColor="#000066" />
        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
        <SelectedRowStyle BackColor="#669999" HorizontalAlign="Center" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#318ADE" Font-Bold="True" ForeColor="White" />
        <RowStyle ForeColor="#000066" BackColor="White" HorizontalAlign="Center" />
        <AlternatingRowStyle BackColor="#E7F7FF" />
    </asp:GridView>

1 个答案:

答案 0 :(得分:0)

删除

中的宽度属性
<ControlStyle Height="14px" Width="14px" />

<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Height="22px" Width="22px"
                CssClass="BotaoGrid"></ItemStyle>

查看布局是否有问题。或者,如果要指定宽度,请确保按钮有足够的空间。