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

Find Element inside ListView using JavaScript

2 Answers 145 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Dominick DeStasio
Top achievements
Rank 1
Dominick DeStasio asked on 17 Mar 2010, 11:58 PM
I have a ListView that has a label to display the start time of an event (bound to the database field).  After the page loads, I need to find all of those labels with JavaScript so that I can update the text to display the start time as the user's local time.

document.getElementById isn't finding the labels when they are inside the ListView, not even if I increment each label via C# when it is initialized so that there are no two labels the same. I can find a label that is outside of the ListView without any issue. What am I missing? How can I access elements within the ListView from the client side?

2 Answers, 1 is accepted

Sort by
0
Dominick DeStasio
Top achievements
Rank 1
answered on 18 Mar 2010, 12:41 AM
Forgot to mention..the page with the ListView has a Master Page....
0
Rosen
Telerik team
answered on 18 Mar 2010, 02:52 PM
Hi Dominick,

Can you please share more details about the page's layout/declaration and how you are trying to get reference to the spans? I suspect that you are missing the prefixes from the IDs of the controls you are searching for, as they are place in NamingContainers thus their clientIDs are not the same as server-side IDs.

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
Dominick DeStasio
Top achievements
Rank 1
Answers by
Dominick DeStasio
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or