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

Forums / General Discussions / news view

news view

9 posts, 0 answered
  1. NuToSitefinity
    NuToSitefinity avatar
    140 posts
    Registered:
    01 Sep 2010
    29 Mar 2011
    Link to this post
    I'm creating a custom news view page and I'm stuck on pulling out the source, author and summary on my page, I'm able to get everything else, how can I pull those datafields for my custom view?
  2. NuToSitefinity
    NuToSitefinity avatar
    140 posts
    Registered:
    01 Sep 2010
    29 Mar 2011
    Link to this post

    anyone? I've been spinning my wheels on this most of the day.

    I found that if I use this I can get everything however, I can't break it out by category, and populate my correct datalist, does anyone know of a way to do this and bind my correct datalist?

    Telerik.News.NewsManager newsManager = new Telerik.News.NewsManager("News");
       
            IList listOfNewsItems = newsManager.Content.GetContent();
             
           if (listOfNewsItems.Count > 0)
           {
               foreach (Telerik.Cms.Engine.IContent newsItem in listOfNewsItems)
               {
                   Response.Write(newsItem.GetMetaData("Title") + " " + newsItem.GetMetaData("Source") + " " + newsItem.GetMetaData("Author") + " " + newsItem.GetMetaData("Category") + "<br />");
               }
           }
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Mar 2011
    Link to this post
    Hi NuToSitefinity,

    There is only one method to get the meta data for an object and this is GetMetaData that you use. If you want to break the items by a metakey you can use one of the overloads of GetContent where you have filtering by metakey

    http://www.sitefinity.com/help/developer-manual/content-items-get.html#GetContent_by_filter

    All the best,
    Ivan Dimitrov
    the Telerik team
  4. NuToSitefinity
    NuToSitefinity avatar
    140 posts
    Registered:
    01 Sep 2010
    29 Mar 2011
    Link to this post
    I tried that and I can't format my datalist the way I need to
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Mar 2011
    Link to this post
    Hi NuToSitefinity,

    You can get all data for the object, so I am not sure what stops you to format it. Its like you have all pieces from the puzzle, but you cannot range it.

    All the best,
    Ivan Dimitrov
    the Telerik team
  6. NuToSitefinity
    NuToSitefinity avatar
    140 posts
    Registered:
    01 Sep 2010
    30 Mar 2011
    Link to this post
    what I would like to do is bind the data to my datalis which isn't working like It was. I have this and I'm able to bind it to my datalist with no problem, however, I can't show all the data, such as source, author, etc.

    var myNews = new ContentManager("News");
         string categoryName = "Breaking News";
         List<Telerik.Cms.Engine.IMetaSearchInfo> filter = new List<Telerik.Cms.Engine.IMetaSearchInfo>();
         filter.Add(new Telerik.Cms.Engine.MetaSearchInfo(Telerik.Cms.Engine.MetaValueTypes.ShortText, "Category", categoryName, Telerik.Cms.Engine.SearchCondition.Equal));
         IList items = myNews.GetContent(0, 2, filter.ToArray());
        dl.DataSource = items;
        dl.DataBind();

    What happens is this, I have 3 tabs and on each tab I'm showing news based on the category, and the above code allows me to do that, however, I need so show some more data such as author, summary and source, which the above code doesn't not allow me to do but the other way does, which I'll have to use, however, I need to show it in my datalist or within labels so it appears correctly and shows all data for that category not just the last item like what is happening now if I find it to a label
  7. NuToSitefinity
    NuToSitefinity avatar
    140 posts
    Registered:
    01 Sep 2010
    30 Mar 2011
    Link to this post
    bump!

    anyone, I need to get this working and showing summary, author, source, and bind it to my datalist, anyone?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Apr 2011
    Link to this post
    Hello NuToSitefinity,

    Using ItemDataBound and ItemCreated events you should be able to access controls inside your itemTemplate

     <ItemTemplate> 
    <!-- child controls -->         
    </ItemTemplate> 

    and show content item data.


    Kind regards,
    Ivan Dimitrov
    the Telerik team

  9. NuToSitefinity
    NuToSitefinity avatar
    140 posts
    Registered:
    01 Sep 2010
    01 Apr 2011
    Link to this post
    I got it to work, i had to create a custom query to go against the metadata table in the database. I couldn't get all of my data need for my display and that was the only way I was able to
Register for webinar
9 posts, 0 answered