编辑单元格时,在ASPxGridView中将文本框对齐

时间:2012-09-17 13:15:35

标签: asp.net vb.net devexpress aspxgridview

我有一些带有一些列的ASPxGridView。

当我选择一行并进入编辑模式时,我希望这三个复选框(红色的复选框)对齐而不是左对齐:

enter image description here

我找不到正确的属性来对齐它们(或者我做错了什么,也许?)。

这是我的ASPxGridView的代码。

<dx:ASPxGridView ID="grdxFornecedor"  runat="server" AutoGenerateColumns="False" Border-BorderStyle="None"
                Border-BorderWidth="0px" Paddings-Padding="0" SettingsBehavior-AllowSort="true" 
                KeyFieldName="IdFornecedor" Style="margin-right: 0px" 
       ClientInstanceName="grid" Width="975px" >                

     <Paddings Padding="0px" />
    <ClientSideEvents RowClick="function(s, e) {                    
        //s.StartEditRow(e.visibleIndex);
     }" 
    />

     <ClientSideEvents RowDblClick="function(s,e){
        //alert(s.GetFocusedRowIndex());
        //alert(s.GetRowKey(e.visibleIndex));
        //alert(s.GetRowKey(e.htmlEvent.srcElement.cellIndex));
        if(e.htmlEvent.srcElement.cellIndex == 0 || e.htmlEvent.srcElement.cellIndex == 1 ){
            window.open('../Item/Consulta.aspx?Ant=Pl&DETALHE=TRUE&ID_ITEM='+s.GetRowKey(e.visibleIndex),'_blank');
        }
    }"
    />
    <ClientSideEvents EndCallback="OnEndCallback" BeginCallback="OnBeginCallback"/>

    <SettingsCustomizationWindow Enabled="True" PopupVerticalAlign="Below" PopupHorizontalAlign="LeftSides" />

    <Styles>
        <AlternatingRow Enabled="True" CssClass="GridImpar">
        </AlternatingRow>
        <Header CssClass="GridHeader">
        </Header>
        <Row CssClass="GridPar">
        </Row>
    </Styles>
    <Columns>                    
        <dx:GridViewDataTextColumn Caption="FORN-COD" FieldName="CdFornecedor" ToolTip="Código do Fornecedor"
                        HeaderStyle-HorizontalAlign="Center" VisibleIndex="0" SortIndex="0" SortOrder="Ascending" >
                        <EditFormSettings Visible="False" />
                        <HeaderStyle HorizontalAlign="Left" ForeColor="White" Paddings-Padding="3" 
                            SortingImageSpacing="3">
                            <Paddings Padding="3px" />
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </HeaderStyle>
                        <CellStyle HorizontalAlign="Left">
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </CellStyle>
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="FORN-NOM" 
            FieldName="DsFornecedor" ToolTip="Nome do Fornecedor"
                        HeaderStyle-HorizontalAlign="Center" VisibleIndex="1" 
            Width="318px">
                        <EditFormSettings Visible="False" />
                        <HeaderStyle HorizontalAlign="Left" ForeColor="White" Paddings-Padding="3" 
                            SortingImageSpacing="3">
                            <Paddings Padding="3px" />
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </HeaderStyle>
                        <CellStyle HorizontalAlign="Left">
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </CellStyle>
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="FORN-IQF" FieldName="NrIqf"
                        ToolTip="IQF do fornecedor" HeaderStyle-HorizontalAlign="Center" VisibleIndex="2"
                        PropertiesTextEdit-DisplayFormatString="{0}%">
                        <PropertiesTextEdit DisplayFormatString="{0}%">
                        </PropertiesTextEdit>
                        <EditFormSettings Visible="False" />
                        <HeaderStyle HorizontalAlign="Right" ForeColor="White" Paddings-Padding="3" 
                            SortingImageSpacing="3">
                            <Paddings Padding="3px" />
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </HeaderStyle>
                        <CellStyle HorizontalAlign="Right">
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </CellStyle>
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="FORN-IQF Ajuste" FieldName="NrIqfAjuste" ToolTip="IQF de ajuste do fornecedor" HeaderStyle-HorizontalAlign="Center" 
                        VisibleIndex="3">
                        <PropertiesTextEdit DisplayFormatString="{0}%" MaskSettings-Mask="###" 
                            FocusedStyle-HorizontalAlign="Right" Style-HorizontalAlign="Right" >
                            <MaskSettings Mask="###" />
                            <FocusedStyle HorizontalAlign="Right">
                            </FocusedStyle>
                        </PropertiesTextEdit>
                        <EditFormSettings Visible="False" />
                        <HeaderStyle HorizontalAlign="Right" ForeColor="White" Paddings-Padding="3" 
                            SortingImageSpacing="3">
                            <Paddings Padding="3px" />
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </HeaderStyle>
                        <CellStyle HorizontalAlign="Right">
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </CellStyle>
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="FORN-DS" FieldName="DsConceitoFornecedor" ToolTip="Conceito do Fornecedor"
                        HeaderStyle-HorizontalAlign="Center" VisibleIndex="4">
                        <EditFormSettings Visible="False" />
                        <HeaderStyle HorizontalAlign="Right" ForeColor="White" Paddings-Padding="3" 
                            SortingImageSpacing="3">
                            <Paddings Padding="3px" />
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </HeaderStyle>
                        <CellStyle HorizontalAlign="Right">
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </CellStyle>
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="FORN-TAK" FieldName="NrTempoRespostaAceiteKanban" ToolTip="Tempo de resposta aceite do Kanban"
                        HeaderStyle-HorizontalAlign="Center" VisibleIndex="5" >
                        <PropertiesTextEdit DisplayFormatString="" MaskSettings-Mask="#.##" Style-HorizontalAlign="Right">
                            <MaskSettings Mask="#.##" />
                        </PropertiesTextEdit>
                        <HeaderStyle HorizontalAlign="Right" ForeColor="White" Paddings-Padding="3" 
                            SortingImageSpacing="3">
                            <Paddings Padding="3px" />
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </HeaderStyle>
                        <CellStyle HorizontalAlign="Right">
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </CellStyle>
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="FORN-TT" FieldName="NrTempoTransito" ToolTip="Tempo de trânsito"
                        HeaderStyle-HorizontalAlign="Center" VisibleIndex="5">
                        <PropertiesTextEdit DisplayFormatString="" MaskSettings-Mask="#.##"  Style-HorizontalAlign="Right">
                            <MaskSettings Mask="#.##" />
                        </PropertiesTextEdit>
                        <HeaderStyle HorizontalAlign="Right" ForeColor="White" Paddings-Padding="3" 
                            SortingImageSpacing="3">
                            <Paddings Padding="3px" />
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </HeaderStyle>
                        <CellStyle HorizontalAlign="Right">
                            <Border BorderStyle="None" BorderWidth="0px" />
                        </CellStyle>
                    </dx:GridViewDataTextColumn>

        <dx:GridViewCommandColumn  ButtonType="Image" Caption="Ação" VisibleIndex="15" Width="40px">

            <EditButton Visible="True" >
                <Image Url="~/Library/Images/Alterar.png" ToolTip="Alterar">
                </Image>
            </EditButton>
            <CancelButton Image-Url="~/Library/Images/Cancelar.png" Image-ToolTip="Cancelar">
                <Image ToolTip="Cancelar" Url="~/Library/Images/Cancelar.png">
                </Image>
            </CancelButton>
            <UpdateButton Image-Url="~/Library/Images/Salvar.png" Image-ToolTip="Salvar" >
                <Image ToolTip="Salvar" Url="~/Library/Images/Salvar.png">
                </Image>
            </UpdateButton>

            <HeaderStyle HorizontalAlign="Center" ForeColor="White" Paddings-Padding="3" SortingImageSpacing="3">
                <Paddings Padding="3px" />
                <Border BorderStyle="None" BorderWidth="0px" />
            </HeaderStyle>
            <CellStyle>
                <Border BorderStyle="None" BorderWidth="0px" />
            </CellStyle>
        </dx:GridViewCommandColumn>
    </Columns>
    <Border BorderStyle="None" BorderWidth="0px" />            
</dx:ASPxGridView>

有什么想法吗?

谢谢。

2 个答案:

答案 0 :(得分:0)

尝试在列上设置EditCellStyle-Horizo​​ntalAlign属性,如下所示:

<dx:GridViewDataTextColumn>
    <EditCellStyle HorizontalAlign="Left"/>
    ...
</dx:GridViewDataTextColumn>

答案 1 :(得分:0)

您可以为所有列设置默认对齐方式,然后为所需的每个列设置自定义样式:

<dx:ASPxGridView Styles-InlineEditCell-HorizontalAlign="Center">
     <dx:GridViewDataTextColumn EditCellStyle-HorizontalAlign="Right" />
<dx:ASPxGridView/>

或者如果您想使用BatchEdit模式:

<dx:ASPxGridView Styles-BatchEditCell-HorizontalAlign="Center">
     <dx:GridViewDataTextColumn EditCellStyle-HorizontalAlign="Right" />
<dx:ASPxGridView/>

但请注意,DataCheckColumn存在问题:

  

...复选框编辑器在浏览和编辑模式下的渲染方式不同   (在浏览模式下,它在“编辑”中呈现为只读状态 - 可点击)...

     

来源:T108471