Answered by:
Having 2 Update Panel

Question
-
User-557095619 posted
This is my code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="twoUpdatePanel.aspx.cs" Inherits="twoUpdatePanel" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>2 update panel</title> </head> <body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="SM1" runat="server"> </asp:ScriptManager> <asp:Timer ID="timer1" runat="server" Interval="1000" ontick="Timer1_Tick"> </asp:Timer> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> EXAM 1<br /><br /> <asp:Label ID="lblTimer" runat="server"></asp:Label> <br /> <br /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="timer1" EventName="Tick" /> </Triggers> </asp:UpdatePanel> <br /><br /> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> Favourite Actor: <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>--Select--</asp:ListItem> <asp:ListItem>Mel Gibson</asp:ListItem> <asp:ListItem>Liam Neeson</asp:ListItem> <asp:ListItem>Eric Bana</asp:ListItem> </asp:DropDownList> <br /> <br /> <asp:Button ID="btnSubmit" runat="server" Text="Submit" /> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class twoUpdatePanel : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!SM1.IsInAsyncPostBack) { Session["timeout"] = DateTime.Now.AddHours(Convert.ToDouble(1)).AddMinutes(Convert.ToDouble(0)).AddSeconds(Convert.ToDouble(0)).ToString(); } } protected void Timer1_Tick(object sender, EventArgs e) { if (0 > DateTime.Compare(DateTime.Now, DateTime.Parse(Session["timeout"].ToString()))) { lblTimer.Text = string.Format("Time Left: 00:{0}:{1}", ((Int32)DateTime.Parse(Session["timeout"].ToString()).Subtract(DateTime.Now).TotalMinutes).ToString(), ((Int32)DateTime.Parse(Session["timeout"].ToString()).Subtract(DateTime.Now).Seconds).ToString()); } else { timer1.Enabled = true; Response.Redirect("Logout.aspx"); } } }
When Timer is ticking - I CAN'T Select Favourite Actor. Look's like the Drop Down List also refresh.
What I need to do to make sure only UpdatePanel1 is refresh when Timer is Ticking???
Sunday, March 16, 2014 10:10 AM
Answers
-
User1208776063 posted
make sure only UpdatePanel1 is refresh when Timer is Ticking???You need to set updatemode for the second panel
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, March 16, 2014 11:56 AM -
User2103319870 posted
Hi,
Check the belowl link
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, March 16, 2014 12:22 PM
All replies
-
User1208776063 posted
make sure only UpdatePanel1 is refresh when Timer is Ticking???You need to set updatemode for the second panel
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, March 16, 2014 11:56 AM -
User2103319870 posted
Hi,
Check the belowl link
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, March 16, 2014 12:22 PM