I have built a custom user control and named it DataPartGridCommandItemTemplate.ascx -- in this control there are the normal Add/Refresh buttons which simply use ASP:LinkButton and the respective CommandName properties ("InitInsert" and "RebindGrid")...
Additionally, I have a checkbox control that will ultimately "toggle" me between inline editing and popup forms... So what I need is from within a UserControl (what I call "DataPartUserControl") that contains a RadGrid (what I call "DataPartGrid") which has its CommandItemTemplate built as follows:
The CheckBox control has its event wired-up and I can see that event fire just fine. What I want to do then is raise my own custom event from the command item template user-control... BUT... Every time I check the public Event for null to ensure there is a subscriber before firing the event (and the subsequent null reference exception of course) - there are none.
The initial wire-up to my command item template user-control was being performed in the DataPartGrid_ItemCreated event handler with the simple code of taking the GridCommandItem, using FindControls to find my command-item template user-control and then simply added the event handler...
After checking the forum, it seems like some other solutions were identified where moving the code to the PreRender event solved their problems. I tried this approach and what I found was that the CheckBox event handler was fired before PreRender so once again there was no subscriber to my user-control's published event...
So I'm not sure exacty how/when to get my event wire-up in the right place to ensure the event-wire up happens before the actual post-back event is dispatched to the check box event handler...
Alternately... Is there a better way of achieving this through using the same mechanisms as the LinkButton's use and creating a custom "CommandName" that I could bubble up? If so, how would I access the grid from this nested user control and invoke the FireCommand method?
Thanks!