Web Analytics Made Easy -
StatCounter loop through gridview? - CodingForum

Announcement

Collapse
No announcement yet.

loop through gridview?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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>

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎