user control in a datagrid does not work with a delegate and event

D

David Cho

Hi, I have a user control that raises an event which works perfectly
outside a datagrid. But trying to do this within a datagrid causes
some problems.

Here is what I have. For the given datagrid, in the event handler for
ItemDataBound, I have

enable_disable userContentEnableDisable =
(enable_disable)e.Item.FindControl("userContentEnableDisable");

//tying handler to the event
userContentEnableDisable.OnSelectionModeChange += new
enable_disable.SelectionModeChangeHandler(userContentEnableDisable_OnSelectionModeChange);

Then when I perform an action that raises an event, I get the
System.NullReferenceException.

Again, this user control's delegate and event work without a problem
outside the datagrid. Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top