Showing posts with label updated. Show all posts
Showing posts with label updated. Show all posts

Wednesday, March 28, 2012

Multiple Timers - Only on is ticking

Hi,

I have several UpdatePanels and a timer in each of them, as every panel has to be updated at different intervals. However, using the ASP.NET AJAX timer, only one is triggered and it seems to reset the other timers on the postback and thus the others never trigger. I was testing the Telerik Timer control and all of them were ticking properly, however it looks like they caused a memory leak in the WebDevServer as when using them, memory consumption always quickly shot up to over 1 GB.

Does anyone know of a fix or workaround how to get all timers ticking properly?

Thanks

Hi Daikoku,

as discussed inhttp://forums.asp.net/thread/1648410.aspx, the Ajax timers get reset on postback (even if they are in different update panels). I think they have only begun delving into the potential of these controls. I do not know that there is anything you can do about this behavior at this time.


Hi,

as soon as you put the Timers into the UpdatePanels, they will be reset after a partial postback.

Have you tried putting the Timers outside the UpdatePanels and referencing them as AsyncPostBack triggers?


When I place the timers outside the UpdatePanel, the whole page is reloaded on every tick

Hi,

if the timers are placed outside the UpdatePanel, you should add them as AsyncPostBack triggers for the UpdatePanel.


Thanks, that seems to work

Here is a solution I was able to use. Perhaps this will help someone visualize it. I have two timers counting off; 1 counts seconds, the other counts 60 seconds. each triggers an update panel which adds a number to a labels current integer value and re-enabled the calling trigger.

// codebehindprotected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) { Label1.Text ="0"; Label2.Text ="0"; } }protected void Timer1_Tick(object sender, EventArgs e) {int Time1 = Convert.ToInt16(Label1.Text); Time1 += 1; Label1.Text = Time1.ToString();if (Time1 >= 120)// stop the timer after two minutes ((Timer)sender).Enabled =false;else ((Timer)sender).Enabled =true; }protected void Timer2_Tick(object sender, EventArgs e) {int Time2 = Convert.ToInt16(Label2.Text); Time2 += 1; Label2.Text = Time2.ToString(); ((Timer)sender).Enabled =true; }
 <div> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> Seconds: <asp:Label ID="Label1" runat="server" Style=""></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" /> </Triggers> </asp:UpdatePanel> <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> Minutes: <asp:Label ID="Label2" runat="server" Style=""></asp:Label>  </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer2" /> </Triggers> </asp:UpdatePanel> </div> <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick"> </asp:Timer> <asp:Timer ID="Timer2" runat="server" OnTick="Timer2_Tick"> </asp:Timer>

Multiple Update Panels Question

I'm not sure if this is an ATLAS issue or the way I'm setting this up. What I'm trying to do is have two gridviews updated when one button is clicked. When the user clicks the button the results are returned, but only when all queries to the database are complete. What I want to happen is to update the gridview to display data whenever either query completes so the user can see some data while the oter still loads. Any ideas on how to achieve this?

You need to split up your panels and make sure you're updatemode is set to Conditional. By default Always is used which updates all panels at once. You'll also need to figure out an effective way to trigger the functionality so that you essentially generate two separate callbacks to the server. Maybe click the button and fire the first update, then set a timer and fire another button to start the other update separately.

There's no real clean way to do this with UpdatePanel since it lacks a client side model at the moment. What I do for this is use 'phantom' buttons on a page that are invisible (style.display='none') but are hooked up as triggers for the UpdatePanel. It's a hack for sure, but it's easy enough to do.

Rumor has it that the next update of ATLAS is going to provide better client control of the update panel, but we have to wait for the next refresh to see what that actually looks like.

+++ Rick --


Thanks. I figured that was the only way to do it.

Multiple UpdatePanels

I'm using multiple UpdatePanel on a page, i don't want all of them to get updated when one of them need to be updated.

when i make some action of a control insidr one of them, the whole updatepanels gets updated.

how can i work arround this?

Thanx

Hi

Simply set the option EnablePartialRendering of yor ScriptMangerControl to true and your updates Panel mode to Conditional

EnablePartialRendering="true"

Mode="Conditional"

Multiple UpdatePanels updated by single trigger -- bug or feature?

Hi, not sure if this has been discussed before but..

I'm running April CTP, and I have two UpdatePanels on my page. UpdatePanel1 includes a navbar with various LinkButtons, and the other UpdatePanel2 contains a GridView. I've added a ControlEventTrigger to UpdatePanel2 for the click event of the LinkButtons in UpdatePanel1. UpdatePanel1 has no triggers (I plan on adding triggers at a later time). The issue is, when I click a LinkButton from UpdatePanel1, it updates both UpdatePanels! I would like it to only update UpdatePanel2 as I thought it should, but maybe I am just not understanding the way UpdatePanels work.

I'm thinking the fact that UpdatePanel2 is using a Control Event from UpdatePanel1, this might be the cause of these problems. When I moved the LinkButtons out of UpdatePanel2, UpdatePanel1 was no longer updated. I've included the source code for the two UpdatePanels:

<atlas:UpdatePanel runat="server" ID="UpdatePanel1" Mode="Conditional"> <ContentTemplate> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td><asp:LinkButton CssClass="navlink_selected" ID="homeLinkT" runat="server" OnClick="link_Click" CommandName="home" CommandArgument="1" >home</asp:LinkButton> <asp:LinkButton CssClass="navlink_unselected" ID="aboutLinkT" runat="server" OnClick="link_Click" CommandName="about" CommandArgument="2" >about</asp:LinkButton> <asp:LinkButton CssClass="navlink_unselected" ID="resumeLinkT" runat="server" OnClick="link_Click" CommandName="resume" CommandArgument="3" >resume</asp:LinkButton> <asp:LinkButton CssClass="navlink_unselected" ID="projectsLinkT" runat="server" OnClick="link_Click" CommandName="projects" CommandArgument="4" >projects</asp:LinkButton> <asp:LinkButton CssClass="navlink_unselected" ID="forumLinkT" runat="server" OnClick="link_Click" CommandName="forum" CommandArgument="5" >forum</asp:LinkButton> <asp:LinkButton CssClass="navlink_unselected" ID="contactLinkT" runat="server" OnClick="link_Click" CommandName="contact" CommandArgument="6" >contact</asp:LinkButton> </td> <td style="width:80px"> <atlas:UpdateProgress ID="up1" runat="server"> <ProgressTemplate> <asp:Image ID="Image2" runat="server" ImageUrl="~/images/Hourglass_iconsm.gif"/> </ProgressTemplate> </atlas:UpdateProgress> </td> </tr> </table> </ContentTemplate> </atlas:UpdatePanel> <atlas:UpdatePanel runat="server" ID="UpdatePanel2" Mode="Conditional"> <ContentTemplate> <asp:HiddenField ID="page_id" runat="server" Value="1" /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="page_id" DataSourceID="ObjectDataSource1" ShowHeader="False" GridLines="None" AutoGenerateEditButton="false" > <Columns> <asp:TemplateField> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Height="100%" Text='<%# Bind("page_content")%>' TextMode="MultiLine" Width="600px" Rows="10"></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("page_content")%>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="page_id" HeaderText="page_id" ReadOnly="True" SortExpression="page_id" Visible="False" /> </Columns> </asp:GridView> </ContentTemplate> <Triggers> <atlas:ControlEventTrigger ControlID="homeLinkT" EventName="Click" /> <atlas:ControlEventTrigger ControlID="aboutLinkT" EventName="Click" /> <atlas:ControlEventTrigger ControlID="resumeLinkT" EventName="Click" /> <atlas:ControlEventTrigger ControlID="projectsLinkT" EventName="Click" /> <atlas:ControlEventTrigger ControlID="forumLinkT" EventName="Click" /> <atlas:ControlEventTrigger ControlID="contactLinkT" EventName="Click" /> </Triggers> </atlas:UpdatePanel>

Anyone have any ideas?

Thanks,

Matt

This is not a bug, but the intended result.

Clicking a server control that causes a postback (i.e. a link button or a normal button) when that server control is contained within the ContentTemplate of an UpdatePanel will cause that UpdatePanel to update even if it is not explicitly defined as a trigger. UpdatePanel1 is updating for this reason and UpdatePanel2 is updating because the control is defined as a triggering event.

Ah, thanks for the clarification Joel!

Matt


So is there a way for getting around this? If I have a menu of links and I want some to be loaded into one updatepanel and some into another. Is this even do-able?

Thanks.

Monday, March 26, 2012

My .aspx lost his format when I change a property on design mode

Hello,

I've just updated my project to the new ajax beta 1.

Everything looks fine, but when I make some change on my pages in design mode, the aspx source code lost completly the previous format.

Somebody could help me.

Thanks,

Rodrigo Sendin

Hello Ajax Guys,

I think my problem is related with an issue posted by "tschlarm" today (Beta 1 issues). I am working with Master Pages and I used to work in Design mode. After beta 1 I am having problems with the format of the aspx source code. (the source code format is totally changed when I work in Design)

I´ve modifed my web.config in order to change the tagPrefix of ajax controls (from asp to ajax), and the problem has stoped. My web.config was changed to:

<addtagPrefix="ajax"namespace="Microsoft.Web.UI"assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addtagPrefix="ajax"namespace="Microsoft.Web.UI.Controls"assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addtagPrefix="ajax"namespace="Microsoft.Web.Preview.UI"assembly="Microsoft.Web.Preview"/>

<addtagPrefix="ajax"namespace="Microsoft.Web.Preview.UI.Controls"assembly="Microsoft.Web.Preview"/>

Thanks,
Rodrigo Sendin