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
135
UltraTextEditor containing droppeddown ultragrid
posted

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

Parents
No Data
Reply
  • 37774
    Verified Answer
    posted

    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

Children