RadToolBar Dynamically Assign Event Handler

3 posts, 0 answers
  1. Steve Keating
    Steve Keating avatar
    11 posts
    Member since:
    Apr 2008

    Posted 29 Jul 2008 Link to this post

    Hi All,

    I'm developing a UI framework and have an event handler defined in an interface so that all User controls / content pages can implement functionality through standard defined methods (interface definition). 

    I have a RadToolbar in my ui framework and need to assign its event handler for the button click event in code behind so that each user control can re-define the inner workings of the event based on which buttons have been dynamically added to the toolbar by that page / user control. 

    I can get a reference to the toolbar and dynamically add buttons to it no problem, However when i go to hook up an event handler vs 08 complains. 
    Using the toolbar.ButtonClick += new EventHandler(addresof Event_Handler_Method)  doesn't seem to work. 

    Anyone have any ideas as to how I can accomplish this programmatically or another syntax I can use that works with RadToolBar?  Or am I missing something and doing this entirely incorrectly?

    Thanks,
    SK
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 30 Jul 2008 Link to this post

    Hi Steve Keating,

    What is the programming language you are using? In VB.NET you should use the AddHandler method. In C# you can use the "+=" syntax however you don't need an "addressof". Visual Studio should automatically generate the event handler for you.

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve Keating
    Steve Keating avatar
    11 posts
    Member since:
    Apr 2008

    Posted 30 Jul 2008 Link to this post

    Telerik,

    Thanks!  Apparently I was mixing my language syntaxes.  I've been going back and forth between C# and VB a lot lately.  Using the AddHandler method fixed everything.  Thanks so much.  You guys have been great so far.  Always very quick response times and very useful answers!

    Thanks,
    SK
Back to Top