Groups | Blog | Home
all groups > asp.net building controls > june 2005 >

asp.net building controls : CollectionEditor Remove button event?


lisa NO[at]SPAM starways.net
6/28/2005 2:58:12 PM
I have a custom CollectionEditor. It's not very customized, and is
almost the same as any standard CollectionEditor.

A problem I have, which isn't really a problem, but is irksome, is that
when I go into the CollectionEditor and click on the Remove button, the
control in design mode doesn't update until I close the CollectionForm.

I figure this is wrong, because when I click on the Add button, it
*does* update. And as I said, it's not that big of a deal, because it
does update when I close the CollectionForm.

But I'd like to trap the button click event, so that I can at least see
what's going on. Maybe there *is* a problem, and I just haven't
noticed it yet.

I used the Reflector and found out that there's a private class called
CollectionEditorCollectionForm which has this method:

Private Sub RemoveButton_click(ByVal sender As Object, ByVal e As
EventArgs)

That's nice and all, but it doesn't seem to be accessible to me. I'd
have to create an entire CollectionForm from scratch, I think, and it
doesn't seem worth the effort.

Does anyone know how I can accomplish this?

Thanks,
Lisa
Ken Dopierala Jr.
7/2/2005 1:51:52 PM
Hi Lisa,

Don't know if this will help you because I always design my own forms for
modifying my controls in the IDE. If you can somehow be alerted when this
remove occurs then you can make the update happen like this:

Dim x As New YourDesigner
x.Initialize(Me (or reference to your control))
x.MarkChange()

This will cause the control to update in the design view. Since you can't
capture the button click is there an OnRemove event or anything else you can
tie into to run the code above? If not you may need to add some type of
event to your CollectionEditor that you can somehow capture to tell your
designer to go ahead and update the control. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

[quoted text, click to view]

lisa NO[at]SPAM starways.net
7/11/2005 8:13:29 AM
Hi Ken,

Thanks, but being alerts when the remove occurs is pretty much the same
thing as capturing the event. I think I'm going to have to delve more
deeply.

Lisa


[quoted text, click to view]
Ken Dopierala Jr.
7/11/2005 11:42:07 AM
Hi Lisa,

When a remove occurs it should in some way update your collection. If your
collection is wrapped in a property then the Set on the property may be
called as soon as the remove button is clicked. In the Set you could run
your code. Ken.

[quoted text, click to view]

AddThis Social Bookmark Button