Losing Delegate On Postback

C

Chris A.

I have authored a webcontrol that contains a SimpleCellCollection of
SimpleCell objects. Both have custom typeconverters that handle viewstate
de/serialization. When I click a SimpleCell in the browser, I get a postback
event but I never sink the ImageClickEventHandler delegate. I have seen posts
discussing attributes UniqueID.x and UniqueID.y being used in postbacks but
have no clue how to implement. Can you help? I am running ASP.NET 1.1.

Thanks,
 
M

MasterGaurav

EventHandler needs to be registered with the PostBack.

What interfaces are you implementing - IPostBackDataHandler /
IPostBackEventHandler / both?
How are you handling them?
 
C

Chris A.

Sorry for the delay, I never got an email reply...

Here is what the control structure looks like:

Parent Webcontrol A
|___Collection of Type WebControl B
|__WebControl B
|__ImageButton (sink click event)

For Parent Webcontrol A : WebControl, INamingContainer
For Collection [Serializable()] : Collectionbase
For Webcontrol B : WebControl, IPostBackDataHandler, ICell, INamingContainer

I have a custom typeconverter for both the collection and Webcontrol B. The
typeconverter for the collection works fine but I lose which item (Webcontrol
B) was clicked. Also I can never debug break on SaveViewstate or
LoadViewstate for Webcontrol B.
 
C

Chris A.

In my custom collection I create a delegate for the CellInfoEventHandler when
each SimpleCell is added to the collection:

protected override void OnInsert(int index, object value)
{
SimpleCell cell = (SimpleCell) value;
cell.OnClick += new CellInfoEventHandler(cell_OnClick);
//base.OnInsert (index, value);
}

I can debug and confirm that the SimpleCell exists and is added to the
collection but when I place a breakpoint on the SimpleCell overriden
SaveViewstate() and LoadViewstate() methods it never breaks into these
methods. Obviously the RegisterChildControls and RenderContents methods get
called as each SimpleCell is rendered on the design-time surface and in the
run-time aspx.

Note that I have a custom typeconverter for the SimpleCellCollection and the
SimpleCell. I have looked at the hidden Form values __EVENTTARGET and
__EVENTTARGET to view which SimpleCell has been clicked (essentially each is
an ImageButton). Any more ideas as to what is happening? Much thanks.
 
C

Chris A.

Gaurav,

Thanks for your reply but is your assistance contingent upon a consulting
fee? I note that you are now using (e-mail address removed) versus
(e-mail address removed). Please let me know before I forward you the project.
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top