2012-09-17 51 views
0

我有一個ASPxGridView,有一些列。在編輯單元格時在ASPxGridView中將文本框對齊到右邊

當我選擇一行,在編輯模式進入,我想這3個複選框(紅色的)對齊到右而不是左:

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> 

任何想法?

謝謝。

+0

你爲什麼不直接接觸DevExpress的傢伙? – Mikhail

回答

0

嘗試像這樣設置在列EditCellStyle-horizo​​ntalAlign屬性:

<dx:GridViewDataTextColumn> 
    <EditCellStyle HorizontalAlign="Left"/> 
    ... 
</dx:GridViewDataTextColumn> 
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