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
705
Resetting a combo box in the ultragrid
posted

I have 2columns on my grid that use a drop down (combo) box with a value list.  The display value is merely text while the underlying member data of the drop down is a Guid. 

I want to be able to "reset" (have the grid show nothing selected) drop down A when drop down B has a value selected out of it.  Conversely I want to "reset" (have the grid show nothing selected) drop down B when an item in drop down A has been selected.

When I try to set the .Value property of the cell for the active row, I get the error can't convert a string to a Guid.  I understand that this relates to my underlying data in my drop down.

What property/event can I use to make this work?

  • 69832
    Verified Answer
    Offline posted

    You could set the cell value to Guid.Empty, although the result would be the cell would show a guid with all zeroes rather than nothing at all. Another approach would be (assuming the associated column supports null values) to set the cell value to null, in which case nothing would be selected and no text would show since there is no item selected. Along the same lines, you could add one item to the list with a DataValue of null or DbNull (or, come to think of it, Guid.Empty) and a space char as the display text.