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
385
Struggling with syntax to simply get input value from cell in web grid
posted

Hi,

I think I have been staring at this too long.  I am simply trying to grab the user inputted values  from a grid so that I can update a SQL server database via a stored proc.  This is an ASP.net application

If I do this:

            quantity = UltraWebGrid1.Columns.FromKey("quantity").ToString


I get a runtime error that says "Object reference not set to an instance of an object."

If I do this:

        quantity = UltraWebGrid1.Row.Cells[0].Text

it tells me that "Row is not a member Infragistics.WebUI.UltraWebGrid.UltraWebGrid"

Same with this:

      quantity = UltraWebGrid1.row.getCellFromKey("Quantity")

Can anybody point out what I am doing wrong?  Many thanks in advance!


JCC

Parents
No Data
Reply
  • 19308
    Verified Answer
    posted

    JCCDEVEL said:

    If I do this:

                quantity = UltraWebGrid1.Columns.FromKey("quantity").ToString


    I get a runtime error that says "Object reference not set to an instance of an object."

    Columns.FromKey returns a column object, you need to get down to the cell object which is much easier done through the Row's collection.

    JCCDEVEL said:

    If I do this:

            quantity = UltraWebGrid1.Row.Cells[0].Text

    it tells me that "Row is not a member Infragistics.WebUI.UltraWebGrid.UltraWebGrid"

    You're close here, but you need to use the "Rows" property.  The code should look like UltraWebGrid1.Rows[index].Cells[index].Text

    My guess is that you're looking to get the value that was just updated in the grid, not just a random cell value.  In that case, you can use the grid's UpdateRow event which fires after a value in a row has been updated, and the row has lost focus (or a postback has occurred).  You could also use the UpdateCell event which will fire after each cell value is changed. The documentation is going to be your friend here.  There are examples of how to update, and what the typical code will look like.  Also, if you're using Visual Studio, the intellisense is your friend.  The Intellisense will show you the names of all the methods and properties you can call.  If the name doesn't show up, it doesn't exist.

    Hope this helps,

    -Tony

Children