Showing posts with label system. Show all posts
Showing posts with label system. Show all posts

Monday, March 26, 2012

Updating gridview without postback

Hi!

I want to refresh a gridview without doing postback every second and for do it I use a System.Timer.

I have the grid into an updatepanel and I want to know how can I make, from the elapsed event of the timer, to refresh the grid.

I am trying to use theICallbackEventHandlerbut I can't reach my target.

Could anyone said me if I can do it and how could I do?

I have search code samples but they aren't useful for me.

Try this:

Put a button on the form somewhere, set the onclick event to trigger an update of the gridview. Check that pressing this button updates the gridview as expected.

Make this button invisible by using style='Display:none;'.

On the timer elapsed event add a call to myButton.Click();

Andy.


Finally I have used the Anthem.net library and its panel component. It was very easy working with it doing the refresh without the postback.

There is more information inhttp://www.codeproject.com/Ajax/AnthemNET.asp.

Updating text on page at regular intervals

Okay, I am pretty new to the Atlas/AJAX system, so im just now learning some of these tricks and whatnot. I have a page that basically needs to load a quote every 30 seconds or something. Right now, I have the page setup so that the text can be changed by clicking a javascript button without refreshing the page, but I am trying to get that function to call based on the Timer control included with atlas. any ideas for refreshing text at a regular time interval would be greatly appreciatedthe timer control would be what you want, but there's no way to tell what could be wrong without you showing some code you are trying

Hi,

this is an ideal scenario for theUpdatePanel control. The page can be refreshed at regular intervals by aTimer control. Check the following example:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void TheTimer_Tick(object sender, EventArgs e) { lblUpdate.Text = DateTime.Now.ToString(); }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="TheScriptManager" runat="server"></asp:ScriptManager><%-- Timer --%> <asp:Timer ID="TheTimer" runat="server" Interval="2000" OnTick="TheTimer_Tick"></asp:Timer><%-- UpdatePanel --%> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="TheTimer" EventName="Tick" /> </Triggers> <ContentTemplate> <asp:Label ID="lblUpdate" runat="server"></asp:Label> </ContentTemplate> </asp:UpdatePanel> </form></body></html>