This is a migrated thread and some comments may be shown as answers.

highlighting clicked row in radlistview

3 Answers 207 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Ranjan
Top achievements
Rank 1
Ranjan asked on 29 Nov 2012, 04:38 PM
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.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Nov 2012, 05:04 AM
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.
0
Ranjan
Top achievements
Rank 1
answered on 30 Nov 2012, 10:05 AM
Thanks Princy,
I am using your code but it is not showing clicked item as highlighted.
0
Eyup
Telerik team
answered on 04 Dec 2012, 08:55 AM
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.
Tags
ListView
Asked by
Ranjan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ranjan
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or