2

私は初心者のC#プログラマー(約6か月)であり、ASP.NETでの現在の作業でDevExpressコンポーネントを使用しています。

グリッド内にあるcomboxを埋める方法がわかりません。問題は基本的にこれです。グリッドの各行に表示するタイトル/ビレットがあり、1つの列にこのタイトル/ビレットが支払われたときの銀行口座のリストがあります。それらが存在する場所に少なくとも1つのレコードを表示するか、タイトル/ビレットがまだ支払われていない場合は空にする必要があります。

このサイトでいくつかの例とスレッドを調べ、実装しようとしましたが、効果的な結果をもたらすものは何もありませんでした。

aspxは次のようになります: `

<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>

`

コンボ「PagamentoRealizado」を埋めるために、アカウントを取得するためにデータをフィルタリングするための5つのテーブルがあります。スキーマ:title> Movement_title <financial_movement> content_movement <bank_accountここで、titleとfinancial_movementは、"> "" <"シグナルについてIDをmovement_titleなどに送信します...したがって、繰り返しのタイトルと繰り返しのアカウントのリストがあります。コードビハインドでは、このクエリを(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 (...)

`

塗りつぶしをするのに助けが必要です。誰かが私を助けてくれるなら、私はここで話し合います...ありがとう。

4

1 に答える 1

1

これが私の一時的な解決策です...

私はASPxを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>、ここに正確な動作を行うリソースがあります。

于 2013-02-27T19:41:40.647 に答える