Setting Latitude and Longitude using Eval() syntax

Apr 4, 2008 at 8:31 AM
Hi Velio,

I'd like to set the Latitude and Longitude properties using the Eval() databinding syntax. e.g.

Latitude: <%# Eval("Latitude") %>, Longitude <%# Eval("Longitude") %>
<artem:GoogleMap ID="GoogleMap1" runat="server" Width="420px" Height="300px" Latitude='<%# Eval("Latitude") %>' Longitude='<%# Eval("Longitude") %>' Zoom="17" ></artem:GoogleMap>

The latitude and longitude values were displayed accordingly but the map didn't show anything. On inspecting the HTML output source, I noticed that the Latitude and Longitude Javascript parameter values were set to 0, and not the actual values. (The control works when I hard-coded the lat/long values.)

Just wondering, am I missing out something here?

Thanks in advance.

~Jason
Coordinator
Apr 4, 2008 at 10:41 AM
Hi Jason,

I think I get where and what is causing the problem.
I'm going to fix it and with some small features required will do upload new release tonight or at least tomorrow.

Regards
Coordinator
Apr 5, 2008 at 6:42 PM
I have tested that case with ObjectDataSource and works fine.
Please, send me more details about the DataSource used by you.

Regards
Apr 6, 2008 at 7:45 AM
Hi Velio,

I'm using ASP.NET 3.5. Here's the test code snippet that I'm using:

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp:FormView ID="FormView1" runat="server" DataSourceID="LinqDataSource1">
<ItemTemplate>
Latitude: <asp:Label ID="Label1" runat="server" Text='<%# Eval("Latitude") %>'></asp:Label>,
Longitude: <asp:Label ID="Label2" runat="server" Text='<%# Eval("Longitude") %>'></asp:Label>
<artem:GoogleMap ID="GoogleMap1" runat="server" Width="420px" Height="300px" Latitude='<%# Eval("Latitude") %>' Longitude='<%# Eval("Longitude") %>' Zoom="17" ></artem:GoogleMap>
</ItemTemplate>
</asp:FormView>

<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="Models.PropertiesDataContext" TableName="Properties"
Where="PropertyID == @PropertyID">
<WhereParameters>
<asp:QueryStringParameter Name="PropertyID" QueryStringField="PropertyID"
Type="Int32" DefaultValue="3" />
</WhereParameters>
</asp:LinqDataSource>
</form>

Note that Label1 and Label2 displayed the correct values in the output but the map is blank. The generated Javascript for the map had the following: ..."Latitude":0,"Longitude":0,...

Do let me know if I missed out on any other info. Thanks.

~Jason


velio wrote:
I have tested that case with ObjectDataSource and works fine.
Please, send me more details about the DataSource used by you.

Regards

Coordinator
Apr 6, 2008 at 5:30 PM
Problem reproduced.
Looking for solution.

Regards
Coordinator
Apr 8, 2008 at 7:16 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Apr 8, 2008 at 5:54 PM
Thanks Velio. Looking forward to the next release.

~Jason