Last post Oct 05, 2005 04:32 AM by Callam.Fletcher
Oct 04, 2005 08:51 AM|Callam.Fletcher|LINK
Ok, what i'm trying to do is get a function to add an event handler to a control object. I'm pretty sure i'm approaching the territory of delegates, but they confuse me like nothing else.
In this instance, i want my second "AddPageMenuItem" overloads method to link an event handler with a control. I want to reduce the messy code in Page_Load, and replace it with a generic solution to adding controls to the PageMenuController.
I've pasted my code below.. don't be putt off, it's simple!
' instead of doing this each time, i just want to usethe appropriate overloads method from below
' ex: AddPageMenuItem(lblLoginStatus)
lblLoginStatus.Text = Security.GetLoginStatus
' obviously, it's not a problem for the one above, but when i want the AddPageMenuItem method to add a handler, i don't have a clue what to do!
lnkLogin.Text = IIf(Page.User.Identity.IsAuthenticated, "Logout", "Login")
Oct 04, 2005 05:07 PM|billrob458|LINK
Oct 05, 2005 04:32 AM|Callam.Fletcher|LINK
This is EXACTLY what i was looking for. Thank you very much bill :) - Cal