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

Forums / Developing with Sitefinity / EventsView data lost on postback

EventsView data lost on postback

7 posts, 0 answered
  1. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    22 Jul 2009
    Link to this post
    Hi there,

    I have a page that has a left column. In that left column is an Events View (default sitefinity module) control that displays a short list of upcoming events. It works just as expected... however, in the same left column I also have a News ArchiveTemplate (default sitefinity module) control that lists a set of dates that will filter the list of news items that appear to the right in the main content area of the page. This works as expected as well, but the catch is that when you click a date to filter news items the Events View loses all it's events. I'm guessing that I need to maybe re-bind on postback but it just seems odd that this wasn't accounted for. If this is a case, what would be the recommende approach to either rebind every time or to do a check for Page.IsPostback and rebind. Are there any other settings/parameters that relate to persisting the data that I might not be aware of?

    As always, any help is greatly appreciated!
    Cheers,
    Phill
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    23 Jul 2009
    Link to this post
    Hello Phill Hodgkinson,

    Try adding the following line in the code behind of your control on ButtonClick event.

      this.EventsView1.SingleItemUrl = this.EventsView1.SingleItemUrl; 

    If the problem persists, send the code you are using to us.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    23 Jul 2009
    Link to this post
    Hi Ivan,

    Thanks for getting back to me so quickly. I think maybe I didn't explain things properly though. I have no code behind. I'm using the built in Events View and News Archive controls. These controls can point to a user control for a layout template but I'm not even doing that. So I can't add the line of code you're suppling to the code behind button click event as I have neither code behind nor a button click event.

    Any other suggestions? I'm not sure how I can send the code as there's not code to send. 

    Thanks again!
    Phill
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    23 Jul 2009
    Link to this post
    Hello Phill Hodgkinson,

    I dropped NewsView, EventsView and NewsArchive control on the same page. Then clicked on a date from NewsArchive control. NiewsView showed correct items. EventsView items remained on the same page.

    Can you reproduce the problem with blank master page. I cannot reproduce the problem locally.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    23 Jul 2009
    Link to this post
    Hi Ivan,

    Thanks agian. I can easily reproduce the issue and I can do it without adding the news archive control. So I think I may have narrowed down the issue. If you just add the date query string (?Year=2007&Month=8) that the news archive control adds it will filter out the events in the events list, which means the events list and news list both use the same query string. This of course is an issue if you don't want the events list to be filtered. If your event and news items are both in the same month and year, clicking the news archive filter isn't going to make the events disappear, but it will filter the events list.

    Is there a way to change the query string params that one of these controls expects so there's no confilicts?

    Thanks again!
    Phill
  6. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    23 Jul 2009
    Link to this post
    To add to this issue, I have 3 separate pages, each one has a single item view control (standard built in, no customization) one for news item, one for blog item and one for event item. For some reason with each of these they all have a "all items" or "go back" option at the top, even though I've done nothing to customize these in any way they all go back to a specific news item and not to a list of the items that they are displaying details of. Not sure why this is...

    Cheers,
    Phill
  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    29 Jul 2009
    Link to this post
    Hello Phill Hodgkinson,

    The EventsView and NewsView controls are both based on ContentView. That is why they share the same query strings, but this is only by default. The query keys that you can change can be seen from the screenshot provided.

    Unfortunately there is no easy way to prevent the year and month query string filtering. There is a possible way by overriding the CreateChildControls method, but it will require some work.

    I apologize for the inconvenience. We will consider such case for the future versions.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
Register for webinar
7 posts, 0 answered