Skip to content

Get the selected value of a cell

New Discussion
Ceaser
Ceaser asked on Jul 24, 2008 4:35 PM
Hi,
I am getting an exception (null reference) while taking the active cell value in wingrid.

 

rowIndex = this.ultraGrid1.ActiveCell.Row.Index;

this.ultraGrid1.Rows[rowIndex].Cells[“CellName”].Value.ToString();This execption is obtained when the rows are filtered., and if the rows are not filtered there is no error
Regards,
Pgr2007
Sign In to post a reply

Replies

  • 0
    Matt Snyder
    Matt Snyder answered on Jul 21, 2008 3:55 PM

    I'm not sure why this is happening, since the same code works for me when I tested it when all but one row was filtered out.  Is the null reference exception coming from your code (i.e. "this.ultraGrid1.Rows[rowIndex]" returning null) or from somewhere inside the grid?

    -Matt

    • 0
      Vince
      Vince answered on Jul 22, 2008 12:52 PM

      6 of 1, half dozen of the other, this works for me. 

                   string s = ultraGrid.ActiveRow.Cells["TransactionID"].Text;

      And while I'm here, I'm on my 2nd day of evaluation.  One thing causing me confusion, and the reason I ended up here in the forums, I was expecting the above line of code to be written as

                   string s = ultraGrid.ActiveRow.Columns["TransactionID"].Text;

      I basically wanted to be able to read any of the column values for the currently selected row.  I guess I have to use "Cells" not "Columns" for this, but what I don't understand is, there is a "Columns" property, albeit,

                  ultraGrid.ActiveRow.Band.Columns["TransactionID"]

      What I don't understand is why I can't read the column value out of the columns collection.  And why "Cells" seems to be used as what I call a "Column".  Any insight on the difference between "Cells" and "Columns" in the grid would be appreciated.

      Thanks.

       

      • 0
        Mike Saltzman
        Mike Saltzman answered on Jul 22, 2008 3:30 PM

        A column is an entire columns. It's a range of cells representing the same cell in each row. A cell is a single cell – it is the intersection of a row and a column.

      • 0
        Ceaser
        Ceaser answered on Jul 24, 2008 4:26 PM

        Hi,
        I got when I am getting exception. If I have sorted(grouped) the grid based on any column exception is thrown otherwise none.

        Regards,
        Pgr2007

      • 0
        Ceaser
        Ceaser answered on Jul 24, 2008 4:35 PM

        this

        .ultraGrid.DisplayLayout.Bands[0].Columns["Column"]

        Regards,

        pgr2007

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Ceaser
Favorites
0
Replies
5
Created On
Jul 24, 2008
Last Post
17 years, 7 months ago

Suggested Discussions

Tags

Created by

Created on

Jul 24, 2008 4:35 PM

Last activity on

Feb 11, 2026 5:20 PM