I was wondering how, from an event on the child object inside a templatefield belonging to a gridview, I could reference the row.
[edit: apparently I’m wrong and parent is not null, weird stuff, is all.]
Thing is, there is a checkbox representing a boolean state in relation to a user’s relation to an ID. I have to update that information manually, either by deleting the target row or inserting it, depending of the checkbox state.
The username I can get quite easily, the actual state too, through a function.
So, how do I get the ID that is in the row my gridview is referencing, from within that event?
I absolutely need that information, I can’t use a workaround implying modifications to the database or the method used to do what I intend to do. I absolutely have to use a checkbox, and that event.
Seems the simplest solution I could use was to add an hiddenfield bound on the ID and refer to that instead of going knee deep in esoteric references. It became a simple matter of FindControl.
like (myChkBox.Parent.FindControl(“myHiddenField”) as HiddenField).Value
Maybe not as sexy as it could be, but still, it works, I guess.