I want to change the text of an UltraTextEditor in Cell at runtime:
private void matchEditor_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
UltraGridCell cell = (UltraGridCell)e.Context;
if (e.Button.Key == "NoMatch")
cell.Value = "";
matchEditor.Text = "";
matchEditor.Value = "";
}
Nothing works.
Hello,
I have been looking into your question and tried to reproduce the described behavior, however, on my side, everything seems to work as expected. From the provided code-snippet I'm assuming that you have an editor button in the UltraTextEditor which has to clear the text into the cell. I have created a small sample where I have UltraTextEditor with EditorButton and when the button is clicked if I set the cell Value or SelText property to "" it seems to work correctly.
public Form1() { InitializeComponent(); this.ultraGrid1.DataSource = GenerateData(); textEditor1 = new UltraTextEditor(); editorButton = new EditorButton(); editorButton.Text = "X"; editorButton.Key = "NoMatch"; textEditor1.EditorButtonClick += TextEditor1_EditorButtonClick; this.textEditor1.ButtonsRight.Add(editorButton); ultraGrid1.DisplayLayout.Bands[0].Columns["Text"].EditorComponent = textEditor1; ultraGrid1.DisplayLayout.Bands[0].Columns["Text"].ButtonDisplayStyle = ButtonDisplayStyle.Always; } private void TextEditor1_EditorButtonClick(object sender, EditorButtonEventArgs e) { UltraGridCell _cell = e.Context as UltraGridCell; if(e.Button.Key == "NoMatch") { // _cell.SelText = ""; _cell.Value = ""; } }
Additionally, if you want the user to be able to edit the text, then you should set the CellActivation property of the column which contains UltraTextEditor cells to AllowEdit.
ultraGrid1.DisplayLayout.Bands[0].Columns["Text"].CellActivation = Activation.AllowEdit;
Attached you will find my sample for your reference. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this case.
Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.
Thank you for your cooperation.
Looking forward to hearing from you.
Sincerely,
Teodosia Hristodorova
Associate Software Developer
0243.UltraTextEditor_change_text_in_UltraGrid_Cell.zip
I had to create a work-around and loop through the rows after loading the data.
The real problem:
Any cell value set in Row Initialize cannot be updated in code. It looks like it's binding the cell value.