Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Valuelist in webgrid - changes not updated to database
posted

I have a ultrawebgrid which is bound to a dataset. One of the columns is a foreign key

for which I want to show a dropdownlist with valid values from the foreign key table.

I have this code in InitializeLayout:

   case "DistributionTypeID":
                                    col.Hidden = false;

                                    col.Header.Caption = "Distribution Type";
                                    col.Width = Unit.Pixel(200);
                                    col.Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList;
                                    col.DataType = typeof(int).ToString();
                                    col.ValueList.Style.CssClass = "iggrid-valuelist";

                                    ValueList vlDistType = col.ValueList;
                                    vlDistType.DataSource = DistributionTypes;
                                    vlDistType.DataMember = "DistributionType";
                                    vlDistType.ValueMember = "ID";
                                    vlDistType.DisplayMember = "Name";
                                    vlDistType.DataBind();
                                    col.AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes;
                                    col.DefaultValue = 2;

What works:

Dropdownlist shows up properly with display text and value.

Adding a new row works as expected.

What does not work:

When updating a row, the distribution type changes are not saved. i.e; if the distribution type was "A"

and it is changed to "B", it still saves "A" to the database. All other column changes are saved.

Any suggestions are greatly appreciated.