shobana_raja 0 Newbie Poster
protected void Page_Load(object sender, EventArgs e)

        {

       string categoryName = Commons.TamilNewsLinks;

            var cate = Category.Categories.Where(t => t.Title.ToLower() == categoryName.ToLower());

            if (cate != null && cate.Count() > 0)

            {

                List<IPublishable> posts =

                    Post.GetPostsByCategory(cate.First().Id).ConvertAll((p => p as IPublishable));



                int postCnt = posts.Count;



                if (postCnt >= 10)

                    for (int icount = 0; icount < 10; icount++)

                    {

                        var hyperLink = new HyperLink { Text = string.Concat((icount + 1), ".", posts[icount].Title), NavigateUrl = posts[icount].AbsoluteLink.ToString() };

                        var literal = new Literal();

                        literal.Text = " | ";

                        TopNewsPH.Controls.Add(hyperLink);

                        TopNewsPH.Controls.Add(literal);

                    }

                else

                {

                    for (int icount = 0; icount < postCnt; icount++)

                    {

                        var hyperLink = new HyperLink { Text = string.Concat((icount + 1), ".", posts[icount].Title), NavigateUrl = posts[icount].AbsoluteLink.ToString() };

                        var literal = new Literal();

                        literal.Text = " | ";

                        TopNewsPH.Controls.Add(hyperLink);

                        TopNewsPH.Controls.Add(literal);

                    }

                }

            }

            else

            {

                TopNewsPH.Controls.Add(new Label { Text = categoryName + " does not exist" });

            }



        }

this displays link only from TamilNewsLinks but i need the link to be chnaged when i go inside different category.for example if i go inside cinema it should display top 10 recent links of cinema

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.