2013-02-26 2 views
2

저는 초보자 인 C# 프로그래머 (약 6 개월)입니다. ASP.NET의 현재 작업에서 DevExpress 구성 요소를 사용하고 있습니다.aspxgridview의 값을 사용하여 GridViewDataComboBoxColumn을 채우십시오.

그리드 내부에있는 콤보스를 채우는 것에 대해 전혀 알지 못합니다. 문제는 기본적으로 다음과 같습니다. 그리드의 각 행에 대해 제목/빌릿을 표시하고 하나의 열에이 제목/빌릿이 지급되었을 때의 은행 계좌 목록이 있습니다. 적어도 하나 이상의 레코드가 존재해야하며, 제목/빌릿이 아직 지불되지 않은 경우 비어 있어야합니다.

사이트에서 몇 가지 예제와 스레드를 살펴 보았지만 구현하려고 시도했지만 아무런 효과가 없었습니다.

영문이 하나 다음과 같습니다 `

<dx:ASPxGridView ID="devGridView" ClientInstanceName="devGridView" runat="server" 
    AutoGenerateColumns="False" EnableCallBacks="False" KeyFieldName="ID_TITULO" 
    Width="100%" DataSourceID="odsTitulosReceber"> 
    <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFooter="true" ShowFilterRow="true" /> 
    <SettingsBehavior AllowFocusedRow="true" /> 
    <SettingsDetail ShowDetailRow="true" /> 
    <SettingsPager PageSize="100"> 
    </SettingsPager> 
    <ClientSideEvents RowClick="behavior.rowClick" /> 
    <Columns> 
     <dx:GridViewDataTextColumn FieldName="ID_DOCUMENTO_FISCAL" Caption="Doc. Fiscal" 
     Width="70px"> 
     </dx:GridViewDataTextColumn> 
     <dx:GridViewDataTextColumn FieldName="DS_PESSOA" Caption="Pessoa"> 
     </dx:GridViewDataTextColumn> 
     <dx:GridViewDataTextColumn FieldName="ST_TITULO" Caption="Situação"> 
     </dx:GridViewDataTextColumn> 
     <dx:GridViewDataTextColumn FieldName="DT_EMISSAO" Caption="Emissão"> 
      <PropertiesTextEdit DisplayFormatString="dd/MM/yyyy"> 
      </PropertiesTextEdit> 
     </dx:GridViewDataTextColumn> 
     <dx:GridViewDataTextColumn FieldName="DT_VENCIMENTO" Caption="Vencimento"> 
      <PropertiesTextEdit DisplayFormatString="dd/MM/yyyy"> 
      </PropertiesTextEdit> 
     </dx:GridViewDataTextColumn> 
     <dx:GridViewDataTextColumn FieldName="DT_PAGAMENTO" Caption="Pagamento"> 
      <PropertiesTextEdit DisplayFormatString="dd/MM/yyyy"> 
      </PropertiesTextEdit> 
     </dx:GridViewDataTextColumn> 
     <dx:GridViewDataTextColumn FieldName="VL_TITULO" Caption="Valor" Width="110px"> 
      <PropertiesTextEdit DisplayFormatString="c"> 
      </PropertiesTextEdit> 
     </dx:GridViewDataTextColumn> 
     <dx:GridViewDataTextColumn FieldName="VL_PAGO" Caption="Valor Pago" Width="110px"> 
      <PropertiesTextEdit DisplayFormatString="c"> 
      </PropertiesTextEdit> 
     </dx:GridViewDataTextColumn> 
     <dx:GridViewDataTextColumn FieldName="VL_SALDO" Caption="Valor Saldo" Width="110px"> 
      <PropertiesTextEdit DisplayFormatString="c"> 
      </PropertiesTextEdit> 
     </dx:GridViewDataTextColumn> 
     <bold><dx:GridViewDataComboBoxColumn Caption="Pagamento Realizado" FieldName="CONTAS" > 
      <PropertiesComboBox TextField="DESCRIPTION" ValueField="ID"> 
      </PropertiesComboBox> 
     </dx:GridViewDataComboBoxColumn></bold> 
     <dx:GridViewDataTextColumn FieldName="ID_TITULO" Caption="Título"> 
     </dx:GridViewDataTextColumn> 
    </Columns> 
</dx:ASPxGridView> 

`

콤보 "Pagamento Realizado"를 채우려면 나는 계정을 얻기 위해 데이터를 필터링을 통과하는 5 개 개의 테이블이있다. 스키마 : 제목> movement_title < financial_movement> content_movement < BANK_ACCOUNT 제목과 ">" "<"신호에 대해 등등 ID를 movement_title을 보내고 financial_movement ... 그래서, 나는 반복 제목 반복과 목록을 가지고 계정. 는 코드 숨김에서 나는 올바른 제목에 해당하는 지정된 계정을 얻기 위해 LINQ (사용)이 쿼리를 수행 할 수 있습니다

`

(...) 
from ti in data.FINANCEIRO_TITULOs // TITULOS 
join mt in data.FINANCEIRO_MOVIMENTOS_TITULOs on ti.NR_SEQ_TITULOS_FITI equals mt.NR_SEQ_TITULOS_FITI // MOVIMENTO_TITULOS 
join mv in data.FINANCEIRO_MOVIMENTOs on mt.NR_SEQ_MOVIMENTO_FINANCEIRO_FIMF equals mv.NR_SEQ_MOVIMENTO_FINANCEIRO_FIMF // MOVIMENTOS 
join cm in data.FINANCEIRO_CONTEUDO_MOVIMENTOs on mv.NR_SEQ_MOVIMENTO_FINANCEIRO_FIMF equals cm.NR_SEQ_MOVIMENTO_FINANCEIRO_FIMF // CONTEUDO_MOVIMENTOS 
join co in data.FINANCEIRO_CONTAs on cm.NR_SEQ_CONTAS_FICO equals co.NR_SEQ_CONTAS_FICO // CONTAS 

where 
ti.TP_CREDITO_DEBITO_FITI == 2 && // credito 
ti.ST_SITUACAO_FITI == 3 &&// baixado 
ti.NR_SEQ_TITULOS_FITI.Equals(idTitulo) 
select (...) 

`

나는 채우기를 할 수있는 몇 가지 도움이 필요합니다. 제발, 누군가가 나를 도울 수 있다면, 나는 여기서 토론하기 위해 ... 고마워.

답변

1

여기 내 임시 방편은 ...

나는 내의 GridView 열

<dx:GridViewDataColumn Caption="Pagamento Recebido" FieldName="CONTA"> 
     <DataItemTemplate> 
       <asp:DropDownList DataTextField="Description" runat="server"> 
       </asp:DropDownList> 
     </DataItemTemplate> 
</dx:GridViewDataColumn> 

에 다음과 같은 이벤트에 내가 드롭 다운에 데이터 소스로 내 쿼리를 넣어 영문 입었다. 페이지로드가 매우 느리고 각 문의에 많은 시간이 걸리는 경우가 있습니다.

protected void devGridView_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) 
{ 
    if (e.KeyValue != null) // avoid header and column name 
    { 
     ControlFinder<DropDownList> finder = new ControlFinder<DropDownList>(); 
     finder.FindChildControlsRecursive(e.Row); 

     int idTitulo = e.GetValue("ID_TITULO").ToString().ToInt(); // necessary param 
     using (ErpDataLinq data = new ErpDataLinq()) 
     { 
      finder.FoundControls.Each(f => 
      { 
       f.DataSource = (
       from ti in data.FINANCEIRO_TITULOs // TITULOS 
       join mt in data.FINANCEIRO_MOVIMENTOS_TITULOs on ti.NR_SEQ_TITULOS_FITI equals mt.NR_SEQ_TITULOS_FITI // MOVIMENTO_TITULOS 
       join mv in data.FINANCEIRO_MOVIMENTOs on mt.NR_SEQ_MOVIMENTO_FINANCEIRO_FIMF equals mv.NR_SEQ_MOVIMENTO_FINANCEIRO_FIMF // MOVIMENTOS 
       join cm in data.FINANCEIRO_CONTEUDO_MOVIMENTOs on mv.NR_SEQ_MOVIMENTO_FINANCEIRO_FIMF equals cm.NR_SEQ_MOVIMENTO_FINANCEIRO_FIMF // CONTEUDO_MOVIMENTOS 
       join co in data.FINANCEIRO_CONTAs on cm.NR_SEQ_CONTAS_FICO equals co.NR_SEQ_CONTAS_FICO // CONTAS 

       where 
       ti.TP_CREDITO_DEBITO_FITI == (byte)FinancialBase.OperationType.Credit && // 2 - credito 
       ti.ST_SITUACAO_FITI == (byte)Securities.Status.Closed && // 3 - baixado 
       ti.NR_SEQ_TITULOS_FITI.Equals(idTitulo) // param 
       select new { Description = co.NM_CONTA_FICO }).Distinct(); // distinct - to avoid duplicated values 

       f.DataBind(); 
      }); 

     } 
    } 
} 

글쎄, 내 문제를 해결합니다. 디자인/레이아웃이 손실되었습니다. 나는 지금 페이지를 아름다움으로 만들려고 노력할 것이다.

감사합니다.

편집

누구 ControlFinder<T>과 방법을 이해하려고 노력를 들어, 여기 당신은 정확하게 동작을 수행하는 자원이 있습니다

관련 문제