Example E1082
Visible to All Users

WinForms Data Grid - How to use the Popup Container Editor

This example demonstrates how to:

  • Create and customize a Popup Container editor.
  • Assign the popup container editor to a grid column to display and edit cell values.
  • Handle the QueryPopUp event to pass the cell value to the editor in the dropdown.
    C#
    private void repositoryItemPopupContainerEdit1_QueryPopUp(object sender, CancelEventArgs e) { memoEdit1.EditValue = (sender as PopupContainerEdit).EditValue; }
  • Handle the QueryResultValue event to post the modified value back to the grid cell.
    C#
    private void repositoryItemPopupContainerEdit1_QueryResultValue(object sender, DevExpress.XtraEditors.Controls.QueryResultValueEventArgs e) { e.Value = memoEdit1.EditValue; }

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

WindowsFormsApplication7/Form1.cs(vb)
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { for (int i = 0; i < 5; i++) dataTable1.Rows.Add(new object[] { i, "Text" + i }); } private void repositoryItemPopupContainerEdit1_QueryResultValue(object sender, DevExpress.XtraEditors.Controls.QueryResultValueEventArgs e) { e.Value = memoEdit1.EditValue; } private void repositoryItemPopupContainerEdit1_QueryPopUp(object sender, CancelEventArgs e) { memoEdit1.EditValue = (sender as PopupContainerEdit).EditValue; } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.