0

好的,所以我的问题是我有一个用于显示 googlemaps 的 iframe

iframe 的 src 将设置为使用从数据库中读取的地址作为位置插入到 googlemaps

目前框架只是纯白色,甚至没有出现图片,但是如果将 src 路径放入浏览器 URL 中它工作正常,我拥有的测试 url 是“http://maps.google.com/maps/api /staticmap?markers=27+Landseer+Street,+Belfast&size=500x300&sensor=false"

这是有效的,因为您将看到如果您输入地址栏。

我的目标是让三个框架都单独命名,然后在它们上设置 src。到目前为止,这是我的代码

VB.NET公共类关于继承System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Session("recentAddressmap1") = ""
    Session("recentAddressmap2") = ""
    Session("recentAddressmap3") = ""
    Session("src1") = ""
    Session("src2") = ""
    Session("src3") = ""
    Dim recentCount As Integer
    recentCount = 0
    Dim addresstest As String = "27 Landseer Street"
    Dim words As String() = addresstest.Split(New Char() {" "c})

    ' Use For Each loop over words and display them
    Dim word As String
    Dim newaddress As String = ""
    Dim loopcounter As Integer = 0
    For Each word In words
        If loopcounter = 0 Then
            newaddress = word
            loopcounter = loopcounter + 1
        Else
            newaddress = newaddress & "+" & word
        End If
    Next
    '''''''''''''''''''''''''''''''''''''''''' DO ENTRY RECENT 1 '''''''''''''''''''''''''''''''''''''''''''''''''''
    Session("recentAddressmap1") = newaddress & ",Belfast"
    Session("src1") = "http://maps.google.com/maps/api/staticmap?markers=" & Session("recentAddressmap1") & "&size=500x300&sensor=false"
    'MsgBox(Session("src1"))
    visualAddress1.Attributes.Add("src", Session("src1"))
End Sub

结束类

ASPX

<%@ Page Title="About Us" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="About.aspx.vb" Inherits="email_tester.About" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
               <iframe width="425" height="350" scrolling="no" marginheight="0" marginwidth="0" id="visualAddress1" runat="server"></iframe>

</asp:Content>
4

1 回答 1

0

给 iframe 一个 ID + runat=server 然后从 VB 设置 src 怎么样?

于 2012-07-13T17:11:03.423 回答