I use the args.CurrentView.dataView etc line of code on a deployed dashboard, with the AfterRowChange method and it works lovely.
I added this method using the wizard, and I want to get data from one of the cells in the grid. It doesn’t compile with the above, reports this error:
Error: CS1061 - line 227 (546) - 'System.EventArgs' does not contain a definition for 'CurrentView' and no extension method 'CurrentView' accepting a first argument of type 'System.EventArgs' could be found (are you missing a using directive or an assembly reference?)
I don’t believe it is just a missing using statement, I just think that System.EventArgs doesn’t have a handle to CurrentView.
How do I see what properties the object “args” actually has contained within, so that I can access a field?
If you want to see what properties are all in args use Visual Studio in debug mode, and use a breakpoint to stop inside the method and explore the args object. Otherwise if you have a ref to the DataView otherwise using something like oTrans.Factory(“PartLot”) then just use that instead of current view and just check for Row > -1 before the rest of your logic to be a good citizen.
System.EventArgs is the bare minimum data you can get from an event, and won’t contain anything useful.
I usually find EpiDataView_AfterRowChange(EpiRowChangedArgs args) is more helpful in these cases because it lets you access the view directly instead of needing to go via the grid.
If you are using a BAQDataView you do have an “EpiDataView” one inherits from the other.
So you should be able to trigger that same event.
something like
No it is not, this is just running a BAQ
You should be able to use the grid event you showed above with that code snippet (or something close to it I’ll check when I get a chance)
Got it to work - combination of me giving the wrong field name, and not having .Value after the cell reference.
It was making the grid go black, and only when clicking on a cell would it highlight white. Also was showing an error because it couldn’t find the field.
Once I got the field name correct, with .Value, all is working sweet.