Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try this: </p> <p>Suppose your RepositoryItemGridLookUpEdit is bound like this :</p> <pre><code>repositoryItemGridLookUpEdit1.DisplayMember = "Description"; repositoryItemGridLookUpEdit1.ValueMember = "Id"; // here probably you will use a table from db repositoryItemGridLookUpEdit1.DataSource = new [] { new { Id=1, Description = "Normal" }, new { Id=2, Description = "Discount" }, }; </code></pre> <p>then you have your GridControl and set the DataSource like this :</p> <pre><code>class GridViewDataSource { // the id of the description type public int DescriptionId { get; set; } } // again, this probably is taken from db gridControl2.DataSource = new GridViewDataSource[] { new GridViewDataSource { DescriptionId = 1 }, new GridViewDataSource { DescriptionId = 2 }, new GridViewDataSource { DescriptionId = 1 }, new GridViewDataSource { DescriptionId = 2 }, }; </code></pre> <p>Then you have to create CustomUnboundColumnData event</p> <pre><code>void gridView2_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) { GridView view = sender as GridView; if (e.Column.Name == "UnboundColumn" &amp;&amp; e.IsGetData) { // here you get the Id of the type var value = (int)view.GetListSourceRowCellValue(e.ListSourceRowIndex, TypeColumn); // here you get the "Description", for example "Normal" or "Discount" var text = repositoryItemGridLookUpEdit1.Properties.GetDisplayText(value); // here you can whatever you want, for example set the text of an unbound column to something if(text == "Discount") e.Value = "!!!!"; } } </code></pre> <p>Your TypeColumn should have this properties:</p> <pre><code>this.TypeColumn.Caption = "TypeColumn"; this.TypeColumn.ColumnEdit = this.repositoryItemGridLookUpEdit1; this.TypeColumn.FieldName = "DescriptionId"; this.TypeColumn.Name = "TypeColumn"; </code></pre> <p>And you UnboundColumn these:</p> <pre><code>this.UnboundColumn.Caption = "UnboundColumn"; this.UnboundColumn.FieldName = "None"; this.UnboundColumn.Name = "UnboundColumn"; this.UnboundColumn.UnboundType = DevExpress.Data.UnboundColumnType.String; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload