简体   繁体   English

VB.net 2010的ASP / ASP.net回发问题

[英]ASP / ASP.net postback problems With VB.net 2010

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. 我正在使用Web应用程序,并且我在Web表单中使用了vb.net代码以仅将控件中的设置加载一次。 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. 但我使用的是Google Map控件,每当我的计时器运行时,该控件就会重新加载它的设置并清除我推送的任何数据。我想我需要在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">
&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>

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
 <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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM