More in this section

Forums / Developing with Sitefinity / NewsView Control- Pager Settings

NewsView Control- Pager Settings

4 posts, 0 answered
  1. Richa
    Richa avatar
    69 posts
    Registered:
    04 Jun 2009
    08 Sep 2009
    Link to this post
    On a page which has News in the list view, is there a way to show news listing by alphabets ?
    Visit http://www.hbrcny.com/atoz.html for example
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Sep 2009
    Link to this post
    Hi Richa,

    You can use LinkButtons for your letters. When a letter is clicked you pass the CommandArgumet as  a string. Thus you can use the letter in a FilterExpression condition. You should create a custom control that inherits from NewsView. There you need to apply the filter.

    Below is a sample code:

      private void SearchByLetter(string letter) 
            { 
                ContentPlaceHolder holder = this.Page.Master.FindControl("Content"as ContentPlaceHolder; 
                if (holder != null
                { 
                    this.newsControl = holder.FindControl("CustomNewsView1"as CustomNewsView; 
                    if (this.newsControl != null
                    { 
                        ContentFilterBuilder FilterBuilder = new ContentFilterBuilder(NewsControl); 
                        FilterBuilder.AddFilter(new ContentFilterStatement("Title"string.Concat("\"", letter, "\""), ContentFilter.Condition.Like, ContentFilter.JoinType.And)); 
                        if (!String.IsNullOrEmpty(newsControl.FilterExpression)) 
                        { 
                            newsControl.FilterExpression += " AND Title LIKE '" + letter + "%'"
                        } 
                        else 
                        { 
     
                            newsControl.FilterExpression = "Title LIKE '" + letter + "%'"
                            //} 
                        } 
     
                    } 
     
                } 
            } 


    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. Richa
    Richa avatar
    69 posts
    Registered:
    04 Jun 2009
    09 Sep 2009
    Link to this post
    Thanks, i will try and let you know if it worked.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    10 Sep 2009
    Link to this post
    Hi Richa,

    Let us know how it goes.

    Best wishes,
    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
4 posts, 0 answered