ASPXCOMBOBOX Edit Mode inserts NULL VALUES to database

1.4k Views Asked by At

i am creating an asp application, everything seemed to go well until recently when i decided to use ASPXComboBox in gridview, here is how i put it

ComboBox Gets values from customers table ie

customer_ID -- this is set as value field

Customer_name -- this is set as text field

there is no problem with displaying values.

my problem is when i am on Edit Mode even though previous values of the column are displayed on the combobox if i dont change or re-select the on the combobox it then inserts NULL values to the database while updating.

i desperately need help i have searched all over. please reply

1

There are 1 best solutions below

0
NullReferenceException On

If you are using GridViewDataComboBoxColumn you can get value like this.

GridViewDataComboBoxColumn column = gridView.Columns["ColumnName"] as GridViewDataComboBoxColumn;
string text = column.PropertiesComboBox.Items.FindByValue(e.NewValues["ColumnName"]).Text;

Reference : http://www.devexpress.com/Support/Center/Question/Details/Q450251

here is the demo preoject:

http://www.devexpress.com/Support/Center/Attachment/GetAttachment?fileOid=9eb0e913-6fb0-45fe-90d5-76cabdce740e&fileName=Q381107.zip

http://www.devexpress.com/Support/Center/Question/Details/Q381107