highlighting clicked row in radlistview

4 posts, 0 answers
  1. Ranjan
    Ranjan avatar
    38 posts
    Member since:
    Sep 2011

    Posted 29 Nov 2012 Link to this post

    Hello,
    I am using item template in radlistview control to create items of list.
    I am firing item command on item click. I want that when user click on item then that item looks highlighted on web page. How I will achieve that.
    thanks.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Nov 2012 Link to this post

    Hi,

    Try the following code to make the item selected in listview.
    C#:
    protected void RadListView1_ItemCommand(object sender, Telerik.Web.UI.RadListViewCommandEventArgs e)
    {
      if (e.CommandName == "CommandName")
      {
         RadListViewDataItem item = e.ListViewItem as RadListViewDataItem;
         item.Selected = true;
      }
     }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ranjan
    Ranjan avatar
    38 posts
    Member since:
    Sep 2011

    Posted 30 Nov 2012 Link to this post

    Thanks Princy,
    I am using your code but it is not showing clicked item as highlighted.
  5. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 04 Dec 2012 Link to this post

    Hello Ranjan,

    Have you tried setting CommandName to Select as demonstrated in the following demo:
    http://demos.telerik.com/aspnet-ajax/listview/examples/selecting/defaultcs.aspx

    You could also fire a server side Select command:
    http://www.telerik.com/help/aspnet-ajax/listview-fire-command-events-from-code.html
    as well as a client side command:
    http://www.telerik.com/help/aspnet-ajax/listview-firecommand.html

    I hope this will prove helpful.

    All the best,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top