Hi,
I'm currently building a module for DNN 6 using UpdatePanel.
<asp:UpdatePanel ID="updatePnl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<fieldset>
<legend>Panel with random names</legend>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Generate random names"
Width="200px" />
<br />
<div style="height: 35px; padding-top: 5px; padding-bottom: 5px">
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="updatePnl"
DisplayAfter="100" DynamicLayout="true">
<ProgressTemplate>
<img border="0" src="img/loading.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
</div>
<asp:Label Font-Bold=true ID="lblNames" runat="server" Text="">
</asp:Label>
<br />
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
private readonly string[] NAMES = new string[] {
"Mark", "Tom", "Harry", "Sally", "Sandra", "Paul", "Anastasia" };
/// <summary>
/// This task is running 3 seconds pretending a long-running task
/// </summary>
private void FillListBoxRandom()
{
lblNames.Text = "";
List<String> names = new List<string>();
int count = NAMES.Length;
for (int i = 1; i < 30; i++)
{
System.Threading.Thread.Sleep(100);
Random rnd = new Random();
int number = rnd.Next(count);
string selName = NAMES[number];
if (!names.Contains(selName))
{
names.Add(selName);
}
}
foreach (string name in names)
lblNames.Text += name + "<BR />";
}
protected void Button1_Click(object sender, EventArgs e)
{
FillListBoxRandom();
}
This code works fine when i create a standard .net website for testing. But as soon as I put this into a module I always get a postback page reload which is not what I want. Does anyone know why UpdatePanel doesnt work with DNN.
Thanks