1

私はWebアプリに取り組んでおり、vb.netコードをWebフォームで動作させて、コントロールに設定を1回だけロードしています。しかし、私はGoogleマップコントロールを使用しており、タイマーが実行されるたびに、そのコントロールが設定をリロードし、プッシュしたデータを消去します。ポストバックのリロードを停止するには、asp.net/html側で助けが必要だと思いますコントロール。

これが私のasp.net/htmlコードです。

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width:100%;">
    <tr>
        <td style="width: 668px">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>




<artem:GoogleMap ID="GoogleMap1" runat="server"

    DefaultAddress="999 main st, new york NY, 10541" 
    EnableMapTypeControl="True" EnableOverviewMapControl="False" 
    EnableReverseGeocoding="True" EnableStreetViewControl="False" MapType="Roadmap" 
    MaxZoom="25" MinZoom="12" ShowTraffic="False" Zoom="18" Height="380px" 
    Width="550px" Key="13123123132132132132132123" >
</artem:GoogleMap>
<br />
        </td>
        <td>
            <asp:Button ID="Button1" runat="server" Text="Button" />
            <br />
            <br />

        </td>

    </tr>
  <tr>
  <td style="width: 668px">
  <asp:GridView ID="GridView1" runat="server">
            </asp:GridView>
      <asp:Timer ID="tmUpdateAlarms" runat="server" Enabled="False" Interval="30000">
      </asp:Timer>
  </td>
  </tr>
</table>

私のタイマーコード

 Protected Sub tmUpdateAlarms_Tick(sender As Object, e As System.EventArgs) Handles tmUpdateAlarms.Tick
    tmUpdateAlarms.Enabled = False
    Try
        Dim lqFireFighterconnect As New lqFireFighterConnectDataContext
        Dim lqGetAlarms As New lqAlarmAndGoDataContext
        Dim getDeptGUID = From r In lqFireFighterconnect.tbDeptToPublics
                          Where r.PublicGUID = Request.QueryString("PUBGUID")
                          Select r
        If getDeptGUID.Count = 0 Then
            Exit Sub
        End If
        For Each foundGUID In getDeptGUID.Take(1)
            gotDeptGUID = foundGUID.DeptGUID
        Next
        Dim GetAlarms = From r In lqGetAlarms.AlarmDrops
                            Where r.DeptGUID = gotDeptGUID
                            Order By r.TimeDate Descending
                            Select r
        If GetAlarms.Count = 0 Then
            Exit Sub
        End If
        Dim myCBTable As New DataTable()
        With myCBTable.Columns
            .Add("DateTime", GetType(String))
            .Add("Address", GetType(String))
            .Add("AlarmType", GetType(String))
            .Add("CrossStreet", GetType(String))
            .Add("Status", GetType(String)) '<<<< change the type of this column to what you actually need instead of integer.
        End With
        For Each FoundAlarm In GetAlarms.Take(1)
            If Not GridView1.Rows(0).Cells(1).Text.ToString = FoundAlarm.AlarmAddress Then
                For Each updateAlarm In GetAlarms.Take(3)
                    myCBTable.Rows.Add(updateAlarm.TimeDate.ToString, updateAlarm.AlarmAddress, updateAlarm.AlarmType, updateAlarm.AlarmCrossStreets, updateAlarm.AlarmStatus)
                Next
                With GridView1
                    .DataSource = myCBTable
                    .DataBind()
                End With
                Dim objmar As New Artem.Google.UI.Marker
                objmar.Address = GridView1.Rows(0).Cells(1).Text.ToString
                'objmar.Animation = Artem.Google.UI.MarkerAnimation.Drop
                objmar.Visible = True
                objmar.Title = GridView1.Rows(0).Cells(1).Text.ToString
                objmar.Icon = "/Images/fire_c.png"
                GoogleMap1.Markers.Add(objmar)
                objmar = Nothing
                GoogleMap1.Address = GridView1.Rows(0).Cells(1).Text.ToString
            End If
        Next

        '  LoadHydrants()
    Catch ex As Exception

    End Try

    tmUpdateAlarms.Enabled = True
End Sub
4

1 に答える 1

0
 <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
             <ContentTemplate>
              <artem:GoogleMap ID="GoogleMap1" runat="server"

    DefaultAddress="999 main st, New York ny, 10541" 
    EnableMapTypeControl="True" EnableOverviewMapControl="False" 
    EnableReverseGeocoding="True" EnableStreetViewControl="False" MapType="Roadmap" 
    MaxZoom="25" MinZoom="12" ShowTraffic="False" Zoom="18" Height="380px" 
    Width="550px" Key="1231231231231231231231321231313213" >
</artem:GoogleMap>
              </ContentTemplate>
            </asp:UpdatePanel>
于 2012-10-26T18:22:52.900 に答える