Tuesday, September 07, 2010

ve: successfully updating gridview with values returned by web service

Posted by david on 6. February 2009 21:32

Listening to The Young Turks.

OK – still trying to figure why POIgrid is not updating.  It updates when I click a button, but not when I try LiteralLongitiude.texttextfield changes or anything else. 

So why would the button trigger the update but not the literal, which is in the same update panel?

One hypothesis is that since the LiteralLongitude is nested inside a div, it’s update isn’t seen by the update panel.  Nope. because the button lick is also inside a similar div & the async postback works correctly.

I tried looking at the UpdatePanel Triggers collection.  A wizard offers me a list of things that I may choose.  I see a Left column text box that’s hanging out there.  Hmmm, is it the sort of events that the control offers?  I check the events for the literal … there’s no value changed event offered. 

I was using a literal cuz I read somewhere that literals were preferable to textboxes or labels for displaying information.  Maybe note.

I change the LiteralLongtitude to TextBoxLongitude.

Load the page, select an empty record, geoservice runs, returns the lat and long to LiteralLatitude and TextBoxLongitude.  POIgrid does not update.

Go back to the UpdatePanel, open the Triggers Collection, add TextBoxLongitude.textchanged to the collection.

Load the page, select an empty record, geoservice runs, returns the lat and long to LiteralLatitude and TextBoxLongitude.  POIgrid does not update.

Listening to: On The Media.

Still not working … I cleaned up any messy names to make sure that

OK – got a workaround … plug the lat long directly into the table. at the same time, plug the lat long into the UpdatePOI object.  This is how it goes:

Select a record ( with no lat long ), POIgrid_SelectedIndexChanged is fired:
        create one string address from the individual parts - addressInput;
        create a new latlong object - resultLatLong; 
        create a new VEWSGeo object;
        set the VEWSGeo.clientIP to Page.Request.UserHostAddress;
        set resultLatLong = VEWSGeo.call VEWSGeo.GetLatLong(addressInput);
        create a new UpdatePOI object;
        set UpdatePOI.Latitude to resultLatLong.Latitude;
        set UpdatePOI.Longitude to resultLatLong.Longitude;
        set CurrentRow.Cells[5].Text to resultLatLong.Latitude;  ( or UpdatePOI.Latitude )
        set CurrentRow.Cells[6].Text to resultLatLong.Longitude;  ( or UpdatePOI.Longitude )
       Call UpdatePOI.updateLatLong()

This both provides visual feedback in the grid, AFTER the VEWSgeo has finished processing, and it also updates the record with the new lat long info.

I definitely need to add validation on the address …  the park Eastlake Triangle on page 10 doesn’t work.  Strangely, it’s not even mashing up the address.  My first thought was that the address couldn’t an intersection … But Lakewood Triangle, another intersection address, worked just fine.

Final Result: 2009_02_06

Comments

Add comment


 

biuquote
Loading