I have a GridView I use for tracking shift times in a time clock application. If a user edits a row, I want to track the changes. In the RowUpdating event of the GV, I am simply trying to reference a bound column ("STShiftTimeID") to pass to my update table. I have tried:
el) - using STShiftTime as a bound column;
TextBox) - using txtSTShiftTimeID as a text box in a template and keep getting the NullReferenceException error. I have checked spelling and no typos.
I also check the e.Keys, e.NewValues, and e.OldValues of the Time-In and Time-Out controls, which work fine. If I try to find the STShiftTimeID value using either of those e values, it just comes back as zero, though I can see the STShiftTimeID in the grid.
So Experts, please, how do I reference the STShiftTimeID in my gridview control?
Dim tbxSTShiftTimeID As TextBox = CType(gvShiftTimes.FindControl("txtSTShiftTimeID"), TextBox)
Dim iShiftTimeID As Integer = 0
If tbxSTShiftTimeID.Text IsNot Nothing Then
iShiftTimeID = tbxSTShiftTimeID.text