Skip to content

Double click cell in ultragrid

New Discussion
Vanessa
Vanessa asked on Oct 18, 2012 10:49 PM

Hello!

Is there an event that allow me to get the value of a cell when a double click is done?

I was trying to find a DoubleClickCell event but it dosen’t exists, the only I found was DoubleClick but it for the component… 🙁

Sign In to post a reply

Replies

  • 0
    Mark
    Mark answered on Sep 10, 2008 4:09 PM

    If you're talking about the Windows Grid, there's definitely a DoubleClickCell event on the UltraWinGrid I have, v7.2.

    Infragistics.Win.UltraWinGrid.UltraGrid grid = new Infragistics.Win.UltraWinGrid.UltraGrid();
    grid.DoubleClickCell += new Infragistics.Win.UltraWinGrid.DoubleClickCellEventHandler(OnGrid_DoubleClickCell);

    • 0
      Vanessa
      Vanessa answered on Sep 10, 2008 4:40 PM

      Hmm I get an erro…

      Error 1 'Infragistics.Win.UltraWinGrid.UltraGrid' does not contain a definition for 'DoubleClickCell' C:\contact\FrmGest.cs 43 18 Contact

      • 0
        Mike Saltzman
        Mike Saltzman answered on Sep 11, 2008 2:05 PM

        What version of the grid are you using? The DoubleClickCell event was added to the grid at some point, so you might have an old version from before it was added. 

        If that's the case, you would need to use the grid.DisplayLayout.UIElement.LastElementEntered property. Call GetContext on the element and pass in a type of UltraGridCell. It will return a cell or null and that should give you what you need. 

      • 0
        Vanessa
        Vanessa answered on Sep 11, 2008 3:58 PM

        The version I have is NetAdvantage 2005 vol 1.

         It seems very complicated… I don't know if I understood what you mean.. 🙁

      • 0
        Mike Saltzman
        Mike Saltzman answered on Sep 11, 2008 4:45 PM

         UIElements can be a bit intimidating until you get used to them. Here's a little sample code to show you what I meant: 

                private void ultraGrid1_DoubleClick(object sender, EventArgs e)
                {
                    UltraGrid grid = (UltraGrid)sender;
                    UIElement element = grid.DisplayLayout.UIElement.LastElementEntered;
                    UltraGridCell cell = element.GetContext(typeof(UltraGridCell)) as UltraGridCell;

                    if (cell != null)
                    {
                        MessageBox.Show("The user just double-clicked a cell.");
                    }
                }

      • 0
        Vanessa
        Vanessa answered on Sep 11, 2008 7:48 PM

        Wow!!! It's works! Thank you so much! 😀

         

        I need to learn more about these things 😀

      • 0
        amar
        amar answered on Oct 12, 2012 7:15 PM

        Hello There,

        Is there a way to add a shortcut key on the wingrid so that it opens up the row template.

        The Row Template Opens on doublick of a row.

        I want a shortcut key on it.

        Regards

      • 0
        Mike Saltzman
        Mike Saltzman answered on Oct 12, 2012 9:46 PM

        You can show the RowEditTemplate any time you want by calling the Show method. 

        this.ultraGrid1.ActiveRow.RowEditTemplate.Show();

      • 0
        amar
        amar answered on Oct 12, 2012 11:11 PM

        I can a null reference exception when i do this.

        On the keydown event of the grid. I am checking if the key is F7 and also looking for activerow is selected.

        But it gives me the null reference exception.

        Regards

      • 0
        amar
        amar answered on Oct 12, 2012 11:11 PM

        I get a null reference exception when i do this.

        On the keydown event of the grid. I am checking if the key is F7 and also looking for activerow is selected.

        But it gives me the null reference exception.

        Regards

      • 0
        Mike Saltzman
        Mike Saltzman answered on Oct 15, 2012 2:00 PM

        If you are getting a NullReferenceException it means you are trying to acces a property or method of an object that is null.

        So what line of code is the exception occurring on, and what is the null object you are trying to access?

      • 0
        amar
        amar answered on Oct 15, 2012 3:33 PM

        The following Code gives me the error.

        The error in on the line where i call the show method.

        "Object reference not set to an instance of an object."

        Private Sub UltraGrid2_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraGrid2.KeyUp
        If e.KeyCode = Keys.F7 Then
         Me.UltraGrid2.ActiveRow.RowEditTemplate.Show()
        End If
        End Sub

      • 0
        amar
        amar answered on Oct 15, 2012 3:35 PM

        Attached is the Sample Application.

      • 0
        Mike Saltzman
        Mike Saltzman answered on Oct 16, 2012 2:07 PM

        Hi,

        Okay, the problem is that the RowEditTemplate property of the row was never assigned. This is because you are applying the RowEditTemplate to the band, not the individual rows. This is easily fixed. Just change the code to:

        Me.UltraGrid2.ActiveRow.RowEditTemplateResolved.Show()

      • 0
        amar
        amar answered on Oct 16, 2012 4:58 PM

        Hello,

        It does not work as expected.

        It shows the template. But the cancel and OK buttons are not working.

        Also the Template position is not correct. It pushes the grid Down.

        Also it does not show the Template of the Active Row. It shows a Blank Row Edit Template.

        Regards

      • 0
        Mike Saltzman
        Mike Saltzman answered on Oct 17, 2012 2:20 PM

        Hi,

        I ran your sample (after making the code change to use RowEditTemplateResolved) and everything is working fine for me. Are you having these problems with the sample posted here? Or some other application?

      • 0
        amar
        amar answered on Oct 17, 2012 3:12 PM

        Hello Mike,
        I made the changes and it doesnt work for me. Does it happen to do anything with the version?

        I am attaching the source code again.

        All I get is a empty Row edit template with no values. and it doesnt work always?

        Regards

         

      • 0
        Mike Saltzman
        Mike Saltzman answered on Oct 17, 2012 10:00 PM

        Hi,

        Sorry… I think I was confused about what you were doing. I’ve been double-click on the row and that’s why it worked for me. Turns out I had the wrong method for showing the RET. Try this:

            Private Sub UltraGrid2_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraGrid2.KeyUp        If e.KeyCode = Keys.F7 Then            If (Not Me.UltraGrid2.ActiveRow Is Nothing) Then                Me.UltraGrid2.ActiveRow.ShowEditTemplate()            End If        End If    End Sub
        
        

         

      • 0
        amar
        amar answered on Oct 17, 2012 10:17 PM

        That worked. Thank you very much. 
        Can you divert you to another post that I made.

        http://www.infragistics.com/community/forums/p/60758/377334.aspx#377334

        Regards

         

      • 0
        amar
        amar answered on Oct 17, 2012 10:38 PM

        Also, when i Double click a row it is supposed to open the template which is working fine.

        However when the Template opens I want to select a particular ultragridproxycell.

        How can I achieve it.

        Regards

      • 0
        Mike Saltzman
        Mike Saltzman answered on Oct 18, 2012 2:10 PM

        Same way you would with any form, set the TabIndex on the control on the RET.

      • 0
        amar
        amar answered on Oct 18, 2012 10:49 PM

        It worked. Thank you.

        All my Ultragridcellproxy were inside a ultragroupbox and its tabindex property was stopping from selecting the cellproxy of the first cell.

        Regards

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Vanessa
Favorites
0
Replies
23
Created On
Oct 18, 2012
Last Post
13 years, 11 months ago

Suggested Discussions

Created by

Created on

Oct 18, 2012 10:49 PM

Last activity on

Feb 20, 2026 11:39 AM