Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 30th, 2008, 04:36 PM
Authorized User
 
Join Date: Jun 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default rss results with scroll

Hello,
I put the last articles box with the rssreader in my site, and I can up the articles listed to the number I want. The problem is that I can't limit the size of the box results and put a scroll vertical on it, in the way that it don't grow up to much on the screen.
Can anyone help me with it?
thank you very much.
Luis J.
http://www.cei-esas.com.pt


 
Old June 3rd, 2008, 01:26 PM
Authorized User
 
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Luis,

This can be achieved quite easily using an <asp:panel> control and setting a fixed height and width along with the scroll bars attribute.

Something like:

Code:
    <asp:Panel ID="panTest" runat="server" Height="100px"  Width="400px" ScrollBars="Vertical">
    <retro:RssReader ID="RssReader2" runat="server" Title="News" RssUrl="~/CMS/GetArticlesRSS.aspx?CatID=17"
        MoreText="read more" MoreUrl="~/News.aspx" />

    </asp:Panel>


should work.

I haven't got round to adding the rssreader in my current site so as return favour :D could you post how you restrict the number of items displayed (was gonna use TOP function in a stored proc to do this) - but would save me figuring it out for myself :)

Cheers



 
Old June 5th, 2008, 05:49 PM
Authorized User
 
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can see I can set the returned number of items in web.config for all RSS feeds but how can I set up for individual instances of the RSSReader control. I thought about adding a new public property to the GetArticlesRSS.aspx page and setting its default value to that of the web.config. However, I need to be able to set this property easily on the control. I created a new property on the control but need to be able to expose this property to the hosting page so that I can pass the value to the GetArticles method. Anyone does this already?

 
Old June 6th, 2008, 12:54 PM
Authorized User
 
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

figured this out myself in the end. Just set a default value to the web.config setting but overridable by passing a querystring in my RSS Reader control:

i.e: RssUrl="~/CMS/GetArticlesRSS.aspx?CatID=17&RssItems=5"

Will return the last 5 items.

If I just want to use the default setting in web.config I dont include the QueryString i.e:

RssUrl="~/CMS/GetArticlesRSS.aspx?CatID=17"

Seems to do the trick

 
Old June 7th, 2008, 02:51 PM
Authorized User
 
Join Date: Jun 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there retroviz.
First of all, thanks very much for your reply. I haven't yet tried it because I've been very busy, but I'll report here my experience when I try it. That's the same reason (busy) that I've not replied to you to alter the number of items in the web.config. Happily you find it yourself, and give another solution too. Only today I went here to the forum (I forgot to subscribe the post and forget totally about it, for the business, for sure).
I have another issue. Sometime ago I've tried to have a rssreader that sort/order the articles not by the last post date, but by the ViewCount, i.e., I'd like to show on my site a list of the most viewed articles. I remember I've tried to build another SQL procedure ordered by ViewCount, another GetArticlesRss.ascx and .cs file, another reader, i.e., I've tried to duplicate all the thing. But, I made this through the control panel on my server because I have a problem with my Visual Studio here on my computer. And I can't get to any result.
Then I've concluded (I don't know if this is right) that all the process I tried mean that the bin file will be changed when I compile, and I can't do that through the control panel. And I give up.
Have you any idea how to do this? Through a Query String in the Rss Reader Control (as you turn it on to the number off items) or some other solution.
If you or somebody have any idea/tip, I'll appreciate very much.
Note: I want to show the two things on my site: The rss articles sorted by last post date, and another ordered by ViewCount.
Thank you very much for your attention.
All the best.
Luis J.


 
Old June 8th, 2008, 04:56 AM
Authorized User
 
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Luis,

Yes am after doing something similar myself (although was thinking to get a list of articles by highest rating i.e. most popular). Perhaps the most flexible solution would be to dynamically re-construct the existing GetArticles stored proc and pass in an OrderBy variable (good article here http://www.4guysfromrolla.com/webtech/010704-1.shtml)

This would be quite a bit more work as so may be easier to create a new stored proc and appropriate methods in your DAL. In your BLL you could create an Enumeration of some sort so you can control the parameters passed back to the DAL (i.e. ByDate, ByViewCount, ByRating).

Then in order to utilise the existing control you could do as I have done above pass the SortBy clause in the querystring:

RssUrl="~/CMS/GetArticlesRSS.aspx?CatID=17&RssItems=5&SortBy=ByR ating"

You would then need to have some logic to ensure that the correct constant has been passed and if it returns false just sort by date (default)

May get chance to have a go at this next week although am just finishing off extending my cms to allow "n" levels of categories (one category > many articles, one category > many categories)

Cheers


 
Old June 9th, 2008, 06:29 AM
Authorized User
 
Join Date: Jun 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello retroviz
I've made the scroll feature. Thank you. You can see it at http://www.cei-esas.com.pt, on the right side.
The other issue (order by ViewCount, Rating, etc.):
Do you mean change the SqlArticlesProvider.cs method
/// <summary>
      /// Retrieves all articles
      /// </summary>
      public override List<ArticleDetails> GetArticles(int pageIndex, int pageSize)
      {
         using (SqlConnection cn = new SqlConnection(this.ConnectionString))
         {
            SqlCommand cmd = new SqlCommand("tbh_Articles_GetArticles", cn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@PageIndex", SqlDbType.Int).Value = pageIndex;
            cmd.Parameters.Add("@PageSize", SqlDbType.Int).Value = pageSize;
            cn.Open();
            return GetArticleCollectionFromReader(ExecuteReader(cmd), false);
         }
      }

to something similar of the Forum Threads in the DAL (SqlForumsProvider.cs)?

/// <summary>
      /// Retrieves approved threads (from any forum) by page
      /// </summary>
      public override List<PostDetails> GetThreads(string sortExpression, int pageIndex, int pageSize)
      {
         using (SqlConnection cn = new SqlConnection(this.ConnectionString))
         {
            sortExpression = EnsureValidSortExpression(sortExpression);
            int lowerBound = pageIndex * pageSize + 1;
            int upperBound = (pageIndex + 1) * pageSize;
            string sql = string.Format(@"SELECT * FROM
(
   SELECT tbh_Posts.PostID, tbh_Posts.AddedDate, tbh_Posts.AddedBy, tbh_Posts.AddedByIP,
   tbh_Posts.ForumID, tbh_Posts.ParentPostID, tbh_Posts.Title, tbh_Posts.Approved,
   tbh_Posts.Closed, tbh_Posts.ViewCount, tbh_Posts.ReplyCount, tbh_Posts.LastPostDate,
   tbh_Posts.LastPostBy, tbh_Forums.Title AS ForumTitle,
      ROW_NUMBER() OVER (ORDER BY {0}) AS RowNum
      FROM tbh_Posts INNER JOIN tbh_Forums ON tbh_Posts.ForumID = tbh_Forums.ForumID
      WHERE ParentPostID = 0 AND Approved = 1
) ForumThreads
   WHERE ForumThreads.RowNum BETWEEN {1} AND {2}
   ORDER BY RowNum ASC", sortExpression, lowerBound, upperBound);
            SqlCommand cmd = new SqlCommand(sql, cn);
            cn.Open();
            return GetPostCollectionFromReader(ExecuteReader(cmd), false);
         }
      }

Thank you.
Cheers.
Luis J.

 
Old June 10th, 2008, 07:34 AM
Authorized User
 
Join Date: Jan 2007
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hadn't seen this code as have never used the forum module but yes, this would certainly work for the articles.








Similar Threads
Thread Thread Starter Forum Replies Last Post
RSS bendjoe BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 October 20th, 2008 10:01 AM
RSS PROBLEMS soheil BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 October 5th, 2007 07:51 PM
Edit Query Results in Results Grid druid2112 SQL Server 2005 1 June 28th, 2007 08:49 AM
how can i use rss abhi_bth ASP.NET 1.0 and 1.1 Basics 1 September 23rd, 2006 11:52 AM
RSS Feeds harpua PHP How-To 4 October 21st, 2005 09:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.