suchandsuch
asked on
Call Method in ContentPlaceHolder Page's CodeBehind from MasterPage Method
Hello,
I have a MasterPage that has a button click event handler in it (BtnLogin_Click) - this login control is wrapped in an updatepanel inside the MasterPage, so that when a user logs in, they see their login info replace the login controls in the MasterPage area.
What I'd like to do, is to be able to tell whatever page is loaded in the ContentPlaceHolder area of this MasterPage, that the user has logged in. Right now, only the items inside the MasterPage's UpdatePanel know that the user has logged in.
One way that I was thinking about would be to have a method in each page that uses this MasterPage, called UpdateItemsAffectedByLogin Status (or something like that), so that when BtnLogin_Click in the MasterPage is executed, a line inside of BtnLogin_Click would call UpdateItemsAffectedByLogin Status in the child or ContentPlaceHolder page's codebehind. This didn't get very far though, because while the child page can see the MasterPage's methods (if wired to do so), the Master, to my knowledge, can not access the child page's methods.
Is there a better way to achieve my goal (I'm sure there is) - or if not, can you help me to identify how to call a method in a ContentPlaceHolder page's CodeBehind, from a MasterPage's method or event handler?
Thank You!
I have a MasterPage that has a button click event handler in it (BtnLogin_Click) - this login control is wrapped in an updatepanel inside the MasterPage, so that when a user logs in, they see their login info replace the login controls in the MasterPage area.
What I'd like to do, is to be able to tell whatever page is loaded in the ContentPlaceHolder area of this MasterPage, that the user has logged in. Right now, only the items inside the MasterPage's UpdatePanel know that the user has logged in.
One way that I was thinking about would be to have a method in each page that uses this MasterPage, called UpdateItemsAffectedByLogin
Is there a better way to achieve my goal (I'm sure there is) - or if not, can you help me to identify how to call a method in a ContentPlaceHolder page's CodeBehind, from a MasterPage's method or event handler?
Thank You!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks raqi0017, you were right on about needing to implement an event and delegate in the masterpage (as well as needing to subscribe to that event in the contentplaceholder page).
I didn't find that link particularly useful, but that may be due to the fact that I haven't really coded my own delegates and events before. Just in case someone else runs into this issue sometime, here's a link that I think is really helpful:
http://blogs.claritycon.com/blogs/steve_holstad/archive/2006/03/04/266.aspx
This isn't to diminish your contribution raqi0017, just to supplement it for users that are at a lower level (like myself). Thanks again.
I didn't find that link particularly useful, but that may be due to the fact that I haven't really coded my own delegates and events before. Just in case someone else runs into this issue sometime, here's a link that I think is really helpful:
http://blogs.claritycon.com/blogs/steve_holstad/archive/2006/03/04/266.aspx
This isn't to diminish your contribution raqi0017, just to supplement it for users that are at a lower level (like myself). Thanks again.
ASKER
I didn't find that link particularly useful, but that may be due to the fact that I haven't really coded my own delegates and events before. Just in case someone else runs into this issue sometime, here's a link that I think is really helpful:
http://blogs.claritycon.com/blogs/steve_holstad/archive/2006/03/04/266.aspx
This isn't to diminish your contribution raqi0017, just to supplement it for users that are at a lower level (like myself). Thanks again.