سؤال

So I have a Dev Express gridview that is being bound to its data source in the cod behind. This data source is just a regular ORM object and it is working fine. I am trying to get one of the columns to turn into a combobox when I hit edit on the record. So far I have been able to accomplish this with the following code:

<dx:GridViewDataComboBoxColumn Caption="Invoice/Return#" 
FieldName="InvoiceNumber" ToolTip="Invoice/Return#"
VisibleIndex="4" Settings-AllowSort="False" Name="cmbOtherCostsInvoice">
<PropertiesComboBox ClientInstanceName="cmbOtherCostsInvoice">
</PropertiesComboBox>
<Settings AllowSort="False"></Settings>
</dx:GridViewDataComboBoxColumn>

and I intercept the row editing event and bind the combo box like so:

protected void gridViewOtherCost_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
{
    var allInvoices = GetCollection<PurchaseOrderInvoice>("PURCHASE_ORDER_KEY = " + purchaseOrder.Key);
    foreach (var item in allInvoices)
    {
        (gridViewOtherCost.Columns[4] as GridViewDataComboBoxColumn).PropertiesComboBox.Items.Add(item.InvoiceNumber, item.InvoiceKey);
    }
}

So this works but I would like to get the combobox to be multi-column. I have some other multi-column ones throughout the app, but none are nested in a gridview so I don't know what to do. Here is an example of the stand alone multi column combo box.

<dx:ASPxComboBox ID="cmbAssetPart" runat="server" CssClass="requiredfield" Width="100px
ValueField="AssetKEY" TextField="AssetID" TextFormatString="{0}">
<Columns>
    <dx:ListBoxColumn FieldName="AssetID" Name="AssetID" />
    <dx:ListBoxColumn FieldName="EntityName" Name="Entity" />
</Columns>

Any idea how I can get this to function?

هل كانت مفيدة؟

المحلول

Define Columns collection between PropertiesComboBox tags:

<dx:GridViewDataComboBoxColumn ....>
    <PropertiesComboBox ClientInstanceName="cmbOtherCostsInvoice">
        <Columns>
            <dx:ListBoxColumn FieldName="AssetID" Name="AssetID" />
            <dx:ListBoxColumn FieldName="EntityName" Name="Entity" />
        </Columns>
    </PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top