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

RadListView Row Collection and Selection

1 Answer 214 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Raymundo Lopez
Top achievements
Rank 1
Raymundo Lopez asked on 24 May 2010, 02:58 PM
Good Morning,

I am currently working with the RadListView to display 4 columns from a datasource. This all works fantastic and is quite fast. I had originally been using the grid but found it to be a little overkill as all I need to do is display the columbs, allow selecting of a row and loading some data when that row is selected.

I have also worked with the repeater and datalist control from the standard asp.net toolkit but found they were a bit more difficult to get access to controls within the ItemTemplate definitions.

The problem I am runing into is as follows. I need to be able to do the following (all in javascript)

1. When a user clicks a row I need to be able to set teh background color of the row and turn off any other rows. I realize the RadListView allows for a postback but it only seems available if you include a button in one of the columns to generate a ItemCommand. What I ended up doing was placing an onclick event in each <tr> definition that allows me to call a javascript routine. The problem I have is that I can pass a referene to the row and change the background color, but I cannot find a way to access any of the other rows in the listview. Is there a way to get this collection of rows so I can handle the selection piece myself by setting the background color?

2. In the javascript function when I pass the row reference, how do I get to the controls? I know I can do a get_dataKeyValues I believe it's called and I can access the databound columns. This works great, but what if I have a simple checkbox control that I want to set it's value in the javascript function? How do I get access to this row collection?

3. I will be forcing a postback once a row is selected and I need to load the assocaited data, will this postback allow me to update the ListView control through the radajaxmanager?

The biggest problem is being able to turn off and on the background color for selection. The itemSelect command in RadListView would have been nice but it generates a postback which I do not want to happen since many of my editors are on the client side until the user is ready to submit the final data.

Any help would be appreciated.

Raymundo Lopez

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 27 May 2010, 12:57 PM
Hello Raymundo,

I have attached a sample test page which demonstrates a possible implementation of a "client-selection" for RadListView using few lines of jQuery.
You will find how to get the RadListView's data items (marked with rlvI or rlvA css classes) and the checkbox element(s) place in the first cell.

Sincerely yours,
Rosen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ListView
Asked by
Raymundo Lopez
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or