Mr_Shaw
asked on
reading newvalues
I have a gridview and I used the following code to read the new values when updating data
string test = e.NewValues[3].ToString();
i got the following error.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
string test = e.NewValues[3].ToString();
i got the following error.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
if e.NewValues.Count >= 4 then
string test = e.NewValues[3].ToString()
end if
string test = e.NewValues[3].ToString()
end if
ASKER
15 column of text, 1 hidden column and a edit/delet button/colum.
A screen shot is below.
gridview.bmp
A screen shot is below.
gridview.bmp
Did you try something like this:
e.NewValues["MyColumnName" ].ToString ()
e.NewValues["MyColumnName"
ASKER
I tried
string test = e.NewValues["record_name"] .ToString( );
and got an error saying 'Object reference not set to an instance of an object.'
i ran a test to see how many columns the code thinks is present. I used
e.NewValues.Count
My result equaled 0
Therefore string test = e.NewValues[3].ToString() would never work. I am really stuck on this one!
string test = e.NewValues["record_name"]
and got an error saying 'Object reference not set to an instance of an object.'
i ran a test to see how many columns the code thinks is present. I used
e.NewValues.Count
My result equaled 0
Therefore string test = e.NewValues[3].ToString() would never work. I am really stuck on this one!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
GridViewUpdateEventArgs
ASKER
Perhaps this solves the problem: string test = e.NewValues[2].ToString();