ItemCreated not fired in MasterPage

2 posts, 0 answers
  1. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 13 Aug 2010 Link to this post

    I've seen this topic raised a couple times in various ways but the solution never seems to relate to what I'm doing. I have a simple master page and content pages.  The menu is in the master page.  The OnItemCreated event is registered and there is a handler in the master page code behind.  The event doesn't fire.  The overall goal is to have the menu on the master page drive the pages that get loaded for content, as well as having some of the pages determine which menu options are available depending on login status and other factors.

    I want ItemCreated to fire because I have NavigateURL set in the markup and want to use the technique of moving those properties into Attributes (at ItemCreated time) so that other events fire and I can manage what happens at runtime.  Is there a better place to do this?  Note that I'm not binding to a data source for the menu data - everything is hardcoded for now.

    (Blowing some steam here)

    Why can't controls just fire and properties just hold data?  Why is it that "this event doesn't fire when that property is set" or "that event doesn't fire when the control is on this kind of page" or "move the property to an attribute if you want it to do this"?  Clients are asking me why it takes a couple hours to just get something to click on a page when to them "it's just a button".  It's because every control I touch has its own personality, its own set of undocumented rules, its own forums to search through.  This is exactly why anti-Microsoft antagonists say ASP.NET takes hours to write something that takes minutes elsewhere.  My response to that is to simply look at the functionality you don't get outside of ASP.NET, and to look at all of the scripting and CSS and code you need to write, even with jQuery or similar libraries, just to get close what's built-in to ASP.NET and Telerik controls.  After all of the chest-thumping on both sides, the net result is still that we have to go through contortions just to make simple things happen on a screen.

    It would be great to see documentation on why things don't work with these controls, as well as how to make them work - an organized collection of the answers we see in these forums every day.  That would save hours of research every week, if not every day.

    OK, I'm done.  Thank you for your indulgence.  ;)
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 19 Aug 2010 Link to this post

    Hi TonyG,

    I am sorry for your confusion. Feel free to ask everytime you don't find the answer in the forum posts or help topics. We will do our best to answer you and explain you.

    Now, on your question:

    If you plan to bind the RadMenu to some data source in future you'll need the ItemDataBound event. When working with data-bound menus, it can be more useful to use the ItemDataBound event, which occurs after the item properties have been set to reflect the data source and which provides access to the DataItem property of an item.

    I can not see a reason why OnItemCreated event does not fire. The presense of NavigateUrl does not makes difference when firing the OnItemCreated event. It only prevents firing the ItemClick event.  I've created a sample project to test your case.

    Please take a look at the attached .zip file.

    If you still need help please send me the full code so I can inspect it and help you.

    All the best,
    Veronica Milcheva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top