Hi,
I have an ultratexteditor which contains a right button displaying a dropdown ultragrid. I would ask you how can I get the parent control(my ultratexteditor in this case) of my ultragrid when i raise an event it :
private void myUltraGrid_checkRow(object sender, EventArgs e) { UltraGrid MyGrid = sender as UltraGrid;//Some code to get my ultraTextEditor's value
}
Reciprocally, how can I access to my ultragrid when i raise an evet on my ultratextEditor? It must be a way I missed in trying to do this?
Thanks in advance
I'm not sure what the 'CheckRow' event is that you're using, but here is some code that worked for me in a quick test using the ClickCell event (and would be applicable to any grid event):
private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e){ UltraGrid grid = (UltraGrid)sender; IOwnedForm form = grid.Parent as IOwnedForm; if (form != null) { UltraTextEditor textEditor = form.Owner as UltraTextEditor; if (textEditor != null) { // Do things with the text editor } }}
As for getting the grid from an instance of the UltraTextEditor, you would get it from the DropDownEditorButton:
UltraGrid grid = ((DropDownEditorButton)this.ultraTextEditor1.ButtonsRight[0]).Control as UltraGrid;
-Matt
Hi Matt, in fact my event is a click event. I missed to explain it.
It's Wonderful. That's what I need. It's works very well.
Thanks a lot.