in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Retrieve value of a GridViewDataComboBoxColumn in RowInserting handler, when using Inline editing mode

Last post 11/19/2008 8:28 PM by Mehul Harry (Developer Express). 1 replies.
Page 1 of 1 (2 items)
Sort Posts:
Previous Next
  • 11/19/2008 9:03 AM

    Retrieve value of a GridViewDataComboBoxColumn in RowInserting handler, when using Inline editing mode

     Hi guys,

    I need to retrieve the selected value of a GridViewDataComboBoxColumn in RowInserting handler, with a grid view set to Inline editing mode.

    Here the code I use to initialize my cell editor and handling the RowInserting event :

    protected void Products_GridView_CellEditorInitialize(Object sender, ASPxGridViewEditorEventArgs e)
    {
                ASPxGridView grid = (ASPxGridView)sender;
                ASPxTextBox textBox = null;
                ASPxComboBox comboBox = null;
                ASPxSpinEdit spinEdit = null;

                if (e.Column.FieldName == "ProductName")
                {
                    comboBox = e.Editor as ASPxComboBox;
                    comboBox.ID = "ProductName_ComboBox";
                    comboBox.DropDownStyle = DropDownStyle.DropDown;
                    comboBox.ValueField = "Guid";
                    comboBox.TextField = "ProductName";
                    comboBox.DataSource = ProductsList;
                    comboBox.DataBind();
                }
    }

    protected void Products_GridView_RowInserting(Object sender, ASPxDataInsertingEventArgs e)
    {
                ASPxGridView grid = sender as ASPxGridView;

                GridViewDataComboBoxColumn column = (GridViewDataComboBoxColumn)grid.Columns["ProductName"];

               // Column is not null, great !

                ASPxComboBox comboBox = (ASPxComboBox)grid.FindEditRowCellTemplateControl(column, "ProductName_ComboBox");

               // comboBox is ALWAYS NULL !!!???


                e.Cancel = true;
                grid.CancelEdit();
     }

    Is there something wrong here ? Why is the FindEditRowCellTemplateControl method returning null ?

    Thanks by advance,

     

    Eric Morand.

  • 11/19/2008 8:28 PM In reply to

    Re: Retrieve value of a GridViewDataComboBoxColumn in RowInserting handler, when using Inline editing mode

    Hi Eric,

    Have you tried the e.NewValues["ProductName"]  property? 

    Custom update data via the RowUpdating event

Page 1 of 1 (2 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED