That is what I though however, it is not updating. I must be missing
something. Here is my code behind:
protected void Button1_Click(object sender, EventArgs e)
{
Thread firstThread = new Thread(new ThreadStart(Coundown));
firstThread.Start();
}
public void Coundown()
{
for (int i = 0; i < 100; i++)
{
ListBox1.Items.Add(i.ToString());
Thread.Sleep(250);
}
}
Here is my aspx page:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ListBox ID="ListBox1" runat="server"
Width="498px"></asp:ListBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ListBox1"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
</form>
"IfThenElse" <sq**********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
You don't have to do anything it updates by itself. hence the updatepanel.
"MikeB" <m@nospam.comwrote in message
news:OX*************@TK2MSFTNGP06.phx.gbl...
>Hello All, I am new to ajax and wanted to start by trying something
simple. I have a web form with an updatepanel and then inside the update
panel I have a listbox. Then outside of the updatepanel I have a button.
In my buttons click event in the cs / code behind, I have a loop that
just inserts items in the listbox. My question is, once I click the
button and the loop begins, how do I get it to update the listbox? Does
this make since? Basically, this kind of mimics a update page I plan on
doing next.
TIA