Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    loop through gridview?

    Hi friends

    i have a gridview with id gvcustomers...it has tow columns latitudes and longitudes

    i want to loop thoiugh the gridview on the client side and get the values

    like this...but the problem i have is mentioned in the comments below


    var theGridView = document.getElementById('<%=gvCustomers.ClientID%>');

    for (var rowCount = 1; rowCount < theGridView.rows.length; rowCount++) {


    /// the numbers in the array are lats and longs which are hard //coded...this where i want the latitude and longitude colmn to come..
    var latlongs = new Array(new VELatLong(45, -110), new VELatLong(45, -114), new VELatLong(45, -90), new VELatLong(45, -95));



    // }

    How can i achieve this...thank you

    akpaga
    Senior Apprentice
    Senior Apprentice
    LTD Bronze - Rating: 3

    Posts: 167
    Joined: Wed May 27, 2009 4:15 pm

    Unrated

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,917
    Thanks
    56
    Thanked 545 Times in 542 Posts
    seems like a weird thing to do to me - to loop through an array so as to make another array that (presumably) you will be looping through later. But anyway.

    Assuming that your theGridView array looks something like this:

    theGridView = [{myLat:"45", myLng:"110"},{myLat:"-45", myLng:"-114"},{myLat:"45", myLng:"-90"},{myLat:"45", myLng:"-95"}]

    you could try something like this:

    Code:
    <script type="text/javascript">
    
    var theGridView = [{myLat:"45", myLng:"110"},{myLat:"-45", myLng:"-114"},{myLat:"45", myLng:"-90"},{myLat:"45", myLng:"-95"}]
    var latlongs =[];
    for (var i = 0; i < theGridView.length; i++) {
    point=new VELatLong ({lat:theGridView[i].myLat,
    					lng:theGridView[i].myLng});
    latlongs.push(point);
    }
    </script>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •