Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

Serialize CommandEventHandler to ViewState?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DC - 14 Apr 2008 19:22 GMT
Hi,

I would like to reuse a webcontrol in several places and when a
certain action is being executed in the webcontrol, a defineable
method should run. That method of course is defined in an event in the
webcontrol:

public event CommandEventHandler MyCallBack;

Now in the hosting control I can do stuff like

myCallBack += this.MyCallbackHandler;

and that will work for that one request, but I have to specify
MyCallbackHandler at every roundtrip. Is it possible to store this
information somehow? I played around with ViewState, but I found out
that a CommandEventHandler cannot be serialized. Am I missing a design
rule?

TIA,
DC
bruce barker - 15 Apr 2008 02:05 GMT
object addresses can not be serialized. you could copy the browsers and
have a string method to store the callback. then on callback use
refection to call the routine.

not sure why you do not want to hookup the callback every postback? some
code has too as they are new class instances.

-- bruce (sqlwork.com)

> Hi,
>
[quoted text clipped - 17 lines]
> TIA,
> DC
DC - 15 Apr 2008 08:37 GMT
> object addresses can not be serialized. you could copy the browsers and
> have a string method to store the callback. then on callback use
[quoted text clipped - 28 lines]
>
> - Zitierten Text anzeigen -

Thanks, Bruce. I thought it was more convenient to set the callback
only once but you are actually right, it is not that much effort to
wire it up on every postback.

Regards
DC

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.