[2008] masterpage contentpage updatepanels
VS 2008, vb.net .net 3.5 sp1.
I have a simple masterpage that formats the basic website. A scriptmanager, a timer a updatepanel and one content panel.
I also have a form that is a web content form based off the masterpage.
In the content I have a updatepanel that contains a number of components.
Here is the issue, whenever the timer trigger fires for the masterpage it is also causing an update which fires the Pageload() on the content page which has undesirable affects. How can I force the content page updatepanel to not fire the callback on the content page yet still update the masterpage?
Masterpage Scriptmanager properties
Code:
<asp:ScriptManager ID="ScriptManager1" runat="server"
AsyncPostBackTimeout="120" AllowCustomErrorsRedirect="False">
</asp:ScriptManager>
Masterpage updatepanel properties.
Code:
<div id="footer">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table class="style2">
<tr>
<td class="style3">
<asp:Label ID="lblTime" runat="server" CssClass="footertext"></asp:Label>
<asp:Timer ID="Timer1" runat="server">
</asp:Timer>
</td>
<td align="center">
<asp:Label ID="lblmanagedby" runat="server" CssClass="footertext" Width="368px"></asp:Label>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
the updatepanel is in the footer Div of the masterpage which contains the timer, a textbox and on the page load I do the following
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblTime.Text = thetime()
Dim uid As String = HttpContext.Current.User.Identity.Name
Dim managedtxt As StringBuilder
managedtxt = New StringBuilder("Site managed by Citrix managed Services")
managedtxt.Append(ControlChars.NewLine)
managedtxt.Append("Welcome: ")
managedtxt.Append(uid)
managedtxt.Append(ControlChars.NewLine)
managedtxt.Append("mailto:[email protected]")
lblmanagedby.Text = managedtxt.ToString
End Sub
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
lblTime.Text = thetime()
End Sub
Protected Function thetime() As String
Dim currenttime As Date = Date.Now
Dim stringtime As String = currenttime.ToString("g")
Return stringtime
End Function
Content form Updatepanel config
Code:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
..... lot's o UI components
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnEdit" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnNew" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnCancel" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnServers" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Re: [2008] masterpage contentpage updatepanels
Do a check in the Page:
vb Code:
If Not ScriptManager1.IsAsyncPostBack Then
'your code
End If