+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Getting a News item ID from codebehind of NewsItemNew

Getting a News item ID from codebehind of NewsItemNew

4 posts, 1 answered
  1. Alessio S.
    Alessio S. avatar
    37 posts
    Registered:
    31 May 2010
    09 Feb 2011
    Link to this post
    I just need to add a custom OnClick event handler to the Save button when creating/editing a News item in order to perform some additional operations. In the NewsItemEdit template the Guid is in the URL as a parameter, but in NewsItemNew I guess the ID has not been assigned yet when the Save button gets pressed. Is there a way to retrieve/assign it at that point?

    Thank you,
    Alessio S.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Feb 2011
    Link to this post
    Hi Alessio S.,

    You should better use the static Executed event of ContentManager class. You can subscribe for it inside Application_Start of the Global.asax

    Kind regards,
    Ivan Dimitrov
    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
  3. Alessio S.
    Alessio S. avatar
    37 posts
    Registered:
    31 May 2010
    09 Feb 2011
    Link to this post
    I need to store data which has been entered in custom controls on the NewsItemNew page though, I could do that if there is a way to pass that data to the event.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Feb 2011
    Link to this post
    Hi Alessio S.,

    If you pass the data as a metakey you can get the content item in the event. Another option is replacing the default view and overriding SaveContent method where you can process your data before calling the base.

    Greetings,
    Ivan Dimitrov
    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
    Answered
Register for webinar
4 posts, 1 answered