|
Rank: Newbie Groups: Member
Joined: 6/15/2008 Posts: 3
|
I'm using the Progress Bar, which works great, with the exception that after the task has compeleted I can't seem to get any Ajax Update Panels to update anymore.
Specficially, I have an update panel that shows the status of work done on a set of files. Prior to putting the Progress Bar on the form, and just running the task on the OnClick event fo a button, at teh end a listing of the status for each file was displayed using test output to a Literal control within the update panel.
Now, however, that doesn't work.
I've tried a variety of configurations, with multiple different Update Panels nested, not nested, all in one Panel, etc. I've tried called Update() in code after all of the processing is done. Nothing works.
Suggestions?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
It would be hard for us to shoot in the dark for issues like this. Can you isolate the problem into a separate test page that demonstrates the problem? Make sure the test page runs because most likely we will need to run and debug into it.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 6/15/2008 Posts: 3
|
I accidently setup this up with the codein a separate file, but here is the code for a sampel progect. Let me know if there is something else that you need. For this, bascially if you press the Test button it will update the Literal with the values in the List Box. When you press Start it should do the same thing in red, but it doesn't.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <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="ScriptManager1" runat="server" /> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:ListBox ID="lbItems" runat="server"> <asp:ListItem>One</asp:ListItem> <asp:ListItem>Two</asp:ListItem> <asp:ListItem>Three</asp:ListItem> <asp:ListItem>Four</asp:ListItem> </asp:ListBox><br /> <br /> <asp:Button ID="btnTest" runat="server" OnClick="btnTest_Click" Text="Test" /> <asp:Button ID="btnStart" runat="server" Text="Start" /> <asp:Button ID="btnStop" runat="server" Text="Cancel" /><br /> <br /> <eo:ProgressBar ID="pbTest" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" ControlSkinID="None" Height="16px" IndicatorColor="LightBlue" Maximum="4" OnRunTask="pbTest_RunTask" ShowPercentage="True" StartTaskButton="btnStart" StopTaskButton="btnStop" Width="250px" /> <br /> <div> <div style="border-right: slategray thin solid; padding-right: 5px; border-top: lightsteelblue thin solid; padding-left: 5px; font-weight: bold; padding-bottom: 1px; border-left: lightsteelblue thin solid; color: white; padding-top: 1px; background-color: steelblue; text-align: left"> Results</div> <div> <asp:Literal ID="lTest" runat="server"></asp:Literal> </div> </div> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html>
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
}
protected void btnTest_Click(object sender, EventArgs e) { foreach (ListItem item in lbItems.Items) { lTest.Text += item.Text+"</br>"; } }
protected void pbTest_RunTask(object sender, EO.Web.ProgressTaskEventArgs e) { lTest.Text = String.Empty;
foreach (ListItem item in lbItems.Items) { if (e.IsStopped) break;
lTest.Text += "<font color=red>"+item.Text+"</font> </br>";
e.UpdateProgress(e.Value + 1); } } }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
I see what you mean. It never will. Please see the comment in the source code tab of the sample code for more details: http://essentialobjects.com/Demo/Default.aspx?path=ProgressBar\_i2Thanks
|
|
Rank: Newbie Groups: Member
Joined: 6/15/2008 Posts: 3
|
Got it. Thanks. One additional question. It seems that within the RunTask event you can't change the Maximum value of the Progress Bar. Is there some way to do this, so that witin the RunTask event I can get the count of how many Items I'm going to be working on an then set the Max to that number? Thank you.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
No. RunTask is for what it is and nothing else.
You don't need to change the ProgressBar's Maximum to show the correct value. You can just set the Maximum as 100 and then call UpdateProgress((int)(current_item * 100 / total_items)).
Thanks
|
|