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
265
NullText on UltraGridCell
posted

Hello-

This post, even though it's old, suggests what I'd like to do should be possible:
http://forums.infragistics.com/forums/p/5107/23272.aspx#23272

I've got an UltraGrid with two columns.

Column 0 is a UltraCombo loaded with a ValueList.
Column 1 is a TextBox.

What I'd like to do is set the NullText property of column 1 whenever the value of column 0 changes.

Using that post above as a model, I've attached a new editor to the cell in column 1 as follows:

UltraTextEditor editor = new UltraTextEditor();
((ISupportInitialize)editor).BeginInit();
editor.NullText = "This is NullText";
((ISupportInitialize)editor).EndInit();
cell.EditorComponent = editor;

Unfortunately, "This is NullText" never displays even though the underlying value in column 1 is in fact null.

NOTE: "This is NullText" is just a test for this post.  What I need to do eventually is assign editor.NullText a value that is associated with the value chosen from the dropdown in column 0.

First, although the above post SUGGESTS this is possible, is what I need to do possible?

If so, what have I done wrong with my code or how should this be handled differently?

Thank you.

  • 69832
    Offline posted

    If you want the NullText for each cell in column1 to change, all you have to do is handle the CellChange event, evaluate the value returned from e.Cell.Column to make sure it was a cell in column0 that has changed, and then set the new value of column1.NullText.

    If you want a different value to be displayed for each cell, you could probably use an EditorWithText with a customized Infragistics.Win.UltraWinEditors.DefaultEditorOwner (one of the constructor overloads for EditorWithText takes an EmbeddableEditorOwnerBase, from which DefaultEditorOwner derives), and override the GetNullText method. In that method implementation you can conditionally return a different value for each cell if you like.