Find Element inside ListView using JavaScript

3 posts, 0 answers
  1. Dominick DeStasio
    Dominick DeStasio avatar
    17 posts
    Member since:
    Dec 2009

    Posted 17 Mar 2010 Link to this post

    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. Dominick DeStasio
    Dominick DeStasio avatar
    17 posts
    Member since:
    Dec 2009

    Posted 17 Mar 2010 Link to this post

    Forgot to mention..the page with the ListView has a Master Page....
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 18 Mar 2010 Link to this post

    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.
Back to Top