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

Forums / Developing with Sitefinity / NewsView working mode

NewsView working mode

6 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    29 Sep 2009
    Link to this post
    Hi,

    I need to dev one custom solution that woks like NewsView but more easier only as receptor part for one incoming item. It's only a control that receipt one itemcontent to output in one selected template. This solution use SimpleControl as source and one control working like NewsView as receptor. I have studied NewsView but i not understand how and where is reading the item that come from another NewsView from my first page when is used as DisplayMode Single.

    It's possible to explian about?

    Regards
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Sep 2009
    Link to this post
    Hello Pierre,

    In your control override InitializeControls. Then call a method which returns a list of your content items. You can use a repeater to show the content items in the master mode. In this template add hyperlink control that will be the tile of your NewsItems. When you click the link you should go to details view where you should have back link and content of the item. You can get the content url using content.UrlWithExtenssion and using String.Concat to form the urls.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    29 Sep 2009
    Link to this post
    Hi,

    Thanks, Actually i searching some way to override the ID=Content of Template used in NewsView DetailMode before render using NewsView class making some extension.

    Some tip?
    Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Sep 2009
    Link to this post
    Hello Pierre,

    You do not need to override it. You need to add the control reference and access this control in your custom control. This will allow you to set the content.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    29 Sep 2009
    Link to this post
    Hi,

    Thanks, Ivan. Could you sugest where i can cast the item that will open the Detail News inside NewsView class. I have implemented my logic inside the NewsView class but to dont get the item content to use or the ID of this item. I supose that is using some querystring with the date and the title Name of input path. What method make this work, i haved serched but ?. How get the current item that come to open the detailView?

    Regards
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Sep 2009
    Link to this post
    Hi Pierre,

    The format comes from the following property of the News provider
    urlRewriteFormat
    ="[Publication_Date]/[Title].aspx". You can get the single item from your repeater - ItemDataBound event.

    Example:

    private void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) 
            { 
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 
                { 
                    IContent contentItem = (IContent)e.Item.DataItem; 
                                      
                                    // do something here 
                            } 
                    } 


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered