I'm working on a web app and i have the vb.net code working in the web form to only load setting in my controls once. but I'm using a google map control and every time my timer runs that control reloads it setting and wipes out any data i push in. i think i need some help in the asp.net/html side to stop on post back reloading the control.
我正在开发一个网络应用程序,我在网络表单中使用vb.net代码只加载我的控件中的设置一次。但我正在使用谷歌地图控件,每次我的计时器运行该控件重新加载它设置并清除我推入的任何数据。我想我需要一些帮助在asp.net/html方面停止回帖重新加载控制。
here is my asp.net/html code.
这是我的asp.net/html代码。
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width:100%;">
<tr>
<td style="width: 668px">
<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>
My Timer Code
我的定时器代码
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
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>
#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>