GridDropDownColumn with customized items on edit, inserts null

2 posts, 0 answers
  1. Adam
    Adam avatar
    4 posts
    Member since:
    Mar 2005

    Posted 11 Nov 2009 Link to this post

    Hi guys,

    Ok, so essentially, I have a grid where the first column is a valuation type.  There should only be one of each valuation type in the whole grid, although there does not necessarily need to be one of each.

    ie: I have four types, there doesn't need to be four rows, but there must not be two rows with the same valuation type.

    Using the code in Customize/Configure GridDropDownColumn when a row is being inserted, I rebind the editor to a new query which excludes any previously used types.  This works perfectly.  The problem is that when the row is inserted, the value of the type (the ID of the lookup value) is null.

    I have traced this through at least some of the events.  I use the grid bound to a LinqDataSource (quick prototyping).  If I debug the InsertCommand event from the grid, I can check the value of the combobox and it is correct.  However by the time it reaches the linq classes and datasource, the value is null.

    Does anyone have any ideas?  I know you might need more code, or detail, but I didn't want to post a whole bunch of code here if it was really a waste of time because I'm being so obviously stupid somewhere else.

  2. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 16 Nov 2009 Link to this post

    I think that it is expected to have the id from the lookup table as null on initial insertion - after all new item in the source still does not exist. Later, when you perform the actual insertion on insert command and item is selected in the dropdown, its value should be available as well to extract it from the dropdown item and update the data source.

    Getting value from column editors in code is shown here.

  3. DevCraft R3 2016 release webinar banner
Back to Top