Showing posts with label regular. Show all posts
Showing posts with label regular. Show all posts

Monday, March 26, 2012

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>

Wednesday, March 21, 2012

Urgent Help: Update Panel and Form Templates? - Need to finish this week ends.

Hello

I am new to ASP .NET so just wanted to confirm.

I actually tried a lot in regular asp .net website to update my textboxes when selecting a value from dropdown list.

but no luck.

so is update panel better in these cases. and does this work without having to code..

because i have two weeks left to this one page. and i was stuck on updating values of text boxes, checkboxes fields when updating ddl. i have ddl inside the formview template.

so when using update pannel: ddl will be outside the formview template??

how does it work basically??

please help asap.

thanks a lot all.

looking forward for reply.

surbhi

Have you use the OnSelectedIndexChanged event of the DDL yet ? Make sure you set the DDL AutoPostBack = true

No. I dont know how to use that event.

I am new and using VB for coding ..

Dont know how to use C#..

How do i use findcontrol statements in vb?

help asap. i have to finish it this week..

Thanks

Surbhi


You would probably benefit the most by looking at tutorials online then waiting for people to reply. Questions about events and c# or vb.net syntax can easily be answered by searching.

Well.. Ofcourse I have been looking online as well.

Not finding enough information on how to use this event..

Meanwhile here is my vb code for ItemUpdating event..

I dont know where I am making mistake. Correct me.. and I am using Formview, Sql DataSource.

and DropDownList which has project numbers. I just want to display new values when I select a different value in DDL. I have AutoPostBack=true and AppendDataBound =True..

Here is the code:

Private

Sub FormView1_ItemUpdating(ByVal senderAs Object,ByVal eAs FormViewUpdateEventArgs)'Dim ProjectNameTextBox As TextBox = FindControl("ProjectName")'Dim FormView1 As FormView = CType(sender, FormView)Dim rowViewAs DataRowView = CType(FormView1.DataItem, DataRowView)Dim rowAs FormViewRow = FormView1.RowDim ProjectNameTextBoxAs TextBox = CType(row.FindControl("ProjectName"), TextBox)

e.NewValues(

"ProjectName") = CType(row.FindControl("ProjectName"), TextBox)

ProjectNameTextBox.Text = rowView(

"ProjectName").ToString()

end sub