Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Choose clicked cell value from an UltraGrid (dynamic)

Choose clicked cell value from an UltraGrid (dynamic)

New Discussion
william gm
william gm asked on Sep 28, 2016 2:41 PM

Hello.

I’m trying to display on a messagebox a particular cell that the user chooses from. I currently have it with fixed values.

var cell = grdSubfamilias.DisplayLayout.Rows[0].Cells[“ClassID”].Value;

MessageBox.Show(“”+ cell);

That code will always display a fixed value from a cell. What I would like the code to do is display the value depending on what cell the user double clicked.

Thanks!

Sign In to post a reply

Replies

  • 0
    Milko Venkov
    Milko Venkov answered on Sep 27, 2016 11:50 AM

    Hello William,

    To determine the cell user was clicked on you may use ElementFromPoint method of UIElement class. Please follow the next link to our online knowledge base where is shown how to get the cell of the UltraGrid where the user has clicked “HOWTO:UltraWinGrid Mouse Position and Cell Identification” and let me know if you have any additional questions.

    • 0
      william gm
      william gm answered on Sep 27, 2016 2:55 PM

      Thanks for the help. Is this the only way to do this? I'm on an ERP environment and have few options available.

      • 0
        Milko Venkov
        Milko Venkov answered on Sep 28, 2016 7:26 AM

        Hello William,

        Most of the controls in Infragistics for Windows Forms are represent of the screen as hierarchical collection of UIElements. You have an access to each of these elements via the control’s main element. The cells in the grid are represented by such elements. So, to answer your question, if not the only way this is the best way to find over which element the mouse is. Then, depending on the type of element, you may get the necessary contextual information you may need. Speaking of the grid’s cell element it contains property Cell, which hold a reference to the cell the element it is responsible for.

        One more thing. Can you explain what your limitations are? What you mean by you are on ERP environment and you have few options available?

        Looking forward to your reply.

      • 0
        william gm
        william gm answered on Sep 28, 2016 2:41 PM

        Milko.

        Excuse my english, maybe I didn't make myself clear. Anyways, I achieved what I wanted by doing the following.

        UltraGridColumn column = this.grdSubfamilias.DisplayLayout.Bands[0].Columns[0];
        UltraGridRow row = this.grdSubfamilias.ActiveRow;
        object cell = row.Cells[column].Value; // CLASS ID VALUE
        MessageBox.Show("You clicked: " + cell);

        Whenever the user double clicks a row on an UltraGrid, the value pops on a MessageBox.

        Thanks for the help Milko!

        Have a nice day.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
william gm
Favorites
0
Replies
4
Created On
Sep 28, 2016
Last Post
9 years, 10 months ago

Suggested Discussions

Tags

Created by

Created on

Sep 28, 2016 2:41 PM

Last activity on

Feb 12, 2026 7:27 PM