0解决方案GridViewDataComboBoxColumn-如何在编辑表单上显示比网格显示更多的列

时间:2019-02-03 19:40:14

标签: c# sql asp.net devexpress

我有两个基于另一个表显示的Int列。 我只想在网格中显示第二(城市)列数据,但要在编辑表单中显示两个字段。 那可能吗? 谢谢!

代码如下:

<dx:ASPxGridView ID="gvOrders" ClientInstanceName="gvOrders" runat="server" AutoGenerateColumns="False"
    DataSourceID="sdsOrders" KeyFieldName="Id" Width="100%"
    OnRowInserting="gvOrders_RowInserting"
    OnRowUpdating="gvOrders_RowUpdating"
    OnCellEditorInitialize="gvOrders_CellEditorInitialize"
    OnInitNewRow="gvOrders_InitNewRow"
    OnStartRowEditing="gvOrders_StartRowEditing"
    OnDetailRowExpandedChanged="gvOrders_DetailRowExpandedChanged"
    OnRowInserted="gvOrders_RowInserted"
    OnRowUpdated="gvOrders_RowUpdated">
<SettingsCommandButton>
    <NewButton Text="New " />
    <EditButton Text=" Edit" />
    <DeleteButton Text="Delete" />
</SettingsCommandButton>

<Columns>
    <dx:GridViewDataComboBoxColumn VisibleIndex="6" Caption="Fitting Loc." FieldName="FittingLoc" Width="100">
    <PropertiesComboBox ClientInstanceName="cmbFitting" ValueField="LocId" EnableCallbackMode="true" Width="250"
        IncrementalFilteringMode="contains" DataSourceID="sdsFitting" TextField="City"
        EnableSynchronization="False" ValueType="System.Int32">
<Columns>
    <dx:ListBoxColumn FieldName="Address" Visible="false" />
    <dx:ListBoxColumn FieldName="City" Visible="true" />
</Columns>
<ValidationSettings>
    <RequiredField IsRequired="false" />
</ValidationSettings>
<ClientSideEvents EndCallback="cmbFitting_EndCallback" />
</PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>
</Columns>
<Templates>
<EditForm>
<dx:ASPxGridViewTemplateReplacement ID="EditorFitting" ReplacementType="EditFormCellEditor" ColumnID="FittingLoc"
runat="server"></dx:ASPxGridViewTemplateReplacement>
<div style="text-align: left; padding: 4px;">
<dx:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton"
    runat="server"></dx:ASPxGridViewTemplateReplacement>
<dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton"
    runat="server"></dx:ASPxGridViewTemplateReplacement>
</div>
</EditForm>
</Templates>

<asp:SqlDataSource ID="sdsOrder" runat="server" ConnectionString="<%$ ConnectionStrings:CoolCorpConnString %>"
    SelectCommand="SELECT * FROM [Order] ORDER BY SortOrder ASC"></asp:SqlDataSource>
<asp:SqlDataSource ID="sdsFitting" runat="server" ConnectionString="<%$ ConnectionStrings:CoolCorpConnString %>"
    SelectCommand="SELECT [LocId], [Address], RTRIM([City])+', '+RTRIM([State])+' '+RTRIM([ZipCode]) as [City]
    FROM [BusinessLocation]"></asp:SqlDataSource>

DevExpress 12.1.8,C#,SQL Server。 在上面的代码中,我仅给出了网格定义,包含位置定义的两列,部分编辑表单和用于获取数据的SQL代码。

完整的地址在屏幕上的网格中占用太多空间。客户目前在两个不同的城镇和州拥有两个地点。可能会成为第三名。公司所有者需要在“编辑/新建”表单的组合框中看到完整的地址,但只能在网格中看到城镇和州。

再次感谢!

0 个答案:

没有答案