Hi,
I have several textBoxes which should be updated every several sec. I have a timer in the updatepanel as well and a label showing the refreshing time.
The label is updated, but not the textboxes.
Here is my code:
the aspx code
ID="Button3" runat="server" Text="Continuous" OnClick="Button3_Click" />
ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
ControlID="Timer1" EventName="Tick" />
ID="Label14" runat="server" Font-Names="Aharoni" ForeColor="#003366" Text="V/C">
ID="VCBox" runat="server" Width="84px">
ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick" Enabled="False">
ID="Label16" runat="server" ForeColor="#009999">
/>
ID="Label17" runat="server" BackColor="#009999">
/>
ID="Label9" runat="server" Font-Names="Aharoni" ForeColor="#003366" Text="Passing within # of cycles">
class="auto-style1">
class="auto-style3">
ID="Label18" runat="server" ForeColor="#006666" Text="<1">
/>
ID="c1" runat="server" Width="62px" style="text-align: center">
class="auto-style3"> ID="Label19" runat="server" ForeColor="#006666" Text="<2">
/>
ID="c2" runat="server" Width="62px">
class="auto-style3">
ID="Label20" runat="server" ForeColor="#006666" Text="<3">
/>
ID="c3" runat="server" Width="62px">
class="auto-style3">
ID="Label21" runat="server" ForeColor="#006666" Text="<4">
/>
ID="c4" runat="server" Width="62px">
ID="Label10" runat="server" Font-Names="Aharoni" ForeColor="#003366" Text="Level of Service">
class="auto-style1">
style="text-align: center" class="auto-style2">
ID="Label22" runat="server" ForeColor="#006666" Text="A">
/>
ID="losA" runat="server" style="margin-top: 0px" Width="62px">
class="auto-style2">
ID="Label23" runat="server" ForeColor="#006666" Text="B">
/>
ID="losB" runat="server" style="text-align: center" Width="62px">
class="auto-style2">
ID="Label24" runat="server" ForeColor="#006666" Text="C">
/>
ID="losC" runat="server" style="text-align: center" Width="62px">
class="auto-style2">
ID="Label25" runat="server" ForeColor="#006666" Text="D">
/>
ID="losD" runat="server" style="text-align: center" Width="62px">
class="auto-style2">
ID="Label26" runat="server" ForeColor="#006666" Text="E">
/>
ID="losE" runat="server" style="text-align: center" Width="62px">
class="auto-style2">
ID="Label27" runat="server" ForeColor="#006666" Text="F">
/>
ID="losF" runat="server" style="text-align: center" Width="62px">
and the aspx.cs code:
protected void Button3_Click(object sender, EventArgs e) { this.Counter1 = 0; Timer1.Enabled=true; } protected void Timer1_Tick(object sender, EventArgs e) { Label16.Text="Current time: " + DateTime.Now.ToLongTimeString(); // ReadList(); Session["2"] = Session["sectionList"]; var line = reader.ReadLine(); var values = line.Split(','); List<String> sectionList2 = (List<String>)Session["sectionList"]; Label17.Text = sectionList2[0]; if (this.Counter1 < sectionList2.Count - 11) { VCBox.Text = sectionList2[this.Counter1].Remove(sectionList2[this.Counter1].Length - 1); c1.Text = sectionList2[this.Counter1 + 1].Remove(sectionList2[this.Counter1 + 1].Length - 1); c2.Text = sectionList2[this.Counter1 + 2].Remove(sectionList2[this.Counter1 + 2].Length - 1); c3.Text = sectionList2[this.Counter1 + 3].Remove(sectionList2[this.Counter1 + 3].Length - 1); c4.Text = sectionList2[this.Counter1 + 4].Remove(sectionList2[this.Counter1 + 4].Length - 1); losA.Text = sectionList2[this.Counter1 + 5].Remove(sectionList2[this.Counter1 + 5].Length - 1); losB.Text = sectionList2[this.Counter1 + 6].Remove(sectionList2[this.Counter1 + 6].Length - 1); losC.Text = sectionList2[this.Counter1 + 7].Remove(sectionList2[this.Counter1 + 7].Length - 1); losD.Text = sectionList2[this.Counter1 + 8].Remove(sectionList2[this.Counter1 + 8].Length - 1); losE.Text = sectionList2[this.Counter1 + 9].Remove(sectionList2[this.Counter1 + 9].Length - 1); losF.Text = sectionList2[this.Counter1 + 10].Remove(sectionList2[this.Counter1 + 10].Length - 1); this.Counter1 = this.Counter1 + 11; Label17.Text=Convert.ToString(this.Counter1); } else { this.Counter1 = 0; } }
Can anybody help me what to do in order the text boxes to be refreshed/updated every 5 seconds with data from a file?
Thanks
Rajagopalan R VPosted Jun 2, 2014, 12:43 AM
With Regards.....,
R.V.Rajagopalan
NelPosted May 30, 2014, 2:04 PM
Hi,
I have solved this by using labels instead of textboxes in update panel
Thanks anyway
Rajagopalan R VPosted May 30, 2014, 6:20 AM
Please Can U Explain Little Bit Clearly and Place Ur Details Clearly its Got Cut,
Then People Can understand Easy to Give Solution
With Regards.....,
R.V.Rajagopalan