My web forms inherits a class called MyPageMain, which inhertis System.Web.UI.Page and is located on the App_Code folder.
In this MyPageMain class I created this method, to record and output Exceptions (error messages):
public string Error(Exception pException, string pFriendlyMessage)
{
using (BusError erro = new BusError())
{
int? errorId = //HERE Routine to log the error;
StringWriter stringWriter = new StringWriter();
using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter))
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "erroMain");
writer.RenderBeginTag(HtmlTextWriterTag.Div); //<div>
writer.RenderBeginTag(HtmlTextWriterTag.P); //<p>
writer.Write(pFriendlyMessage);
writer.RenderEndTag(); // </p>
writer.RenderBeginTag(HtmlTextWriterTag.Small);
writer.Write("Event tracker:");
writer.Write(errorId);
writer.RenderEndTag();
writer.RenderEndTag(); // </div>
Console.WriteLine(stringWriter.ToString());
}
}
}
Then, when there is some exception on the page, I call it, like this:
Protected void btnLoad_Click(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
try
{
//Loading some data here.
}
catch (Exception ex)
{
Error(ex, "Unexpected error trying to load data.");
}
}
This is bulding OK, but doesn't work... I think that one of the reasons may be the fact that the whole thing is inside an UpdatePanel. Any suggestions on how to make this work?
Is this Console.Writeline suitable for what i'm trying to do? Is this going to work on UpdatePanels?
Already Tried with Response.Write(...) and it does work. But not inside an UpdatePanel
When you use an UpdatePanel, you can only update content within the panel during an async postback triggered from that panel, so your error message will have to appear somewhere within the UpdatePanel. (That is, unless you set UpdateMode="Always" on one of your UpdatePanels, then its content is updated on every async and full postback. But that doesn't help you here unless you put your error message in its own UpdatePanel with UpdateMode="Always", which would require you to add said UpdatePanel to every page. I understand this is not what you want to do.)
The following example will work to add the error message at the top of the UpdatePanel.
You will need to add a Control errorParent parameter to your Error method, so it can add the error message as child control to that parent control.
In your catch block, just pass in whatever container control where you want the error message to appear. That control must be a container to accept child controls, so it has to be something that renders as a <div> or <span> tag, like an asp:Panel or asp:UpdatePanel.
In the example below, you could use errorParent.Controls.Add(errorControl) to show the error message at the bottom of the UpdatePanel, or use AddAt() with a different index. Just be sure that index will always work on every page.
Take a parent control and add a new Literal child control:
public string Error(Exception pException, string pFriendlyMessage, Control errorParent)
{
using (BusError erro = new BusError())
{
int? errorId = //HERE Routine to log the error;
Literal errorControl = new Literal();
errorControl.Text = String.Format("<div class=\"errorMain\"><p>{0}</p><small>Event Tracker: {1}</small></div>", pFriendlyMessage, errorId);
errorParent.Controls.AddAt(0, errorControl);
}
}
Pass in the parent control:
private void LoadData()
{
try
{
//Loading some data here.
}
catch (Exception ex)
{
Error(ex, "Unexpected error trying to load data.", MyUpdatePanel.ContentTemplateContainer);
}
}
Since your Error method returns string, you can return error message and display it.
Place Literal in your UpdatePanel (maybe in MasterPage, so you do not have to write it for all 40 or more pages). When exception is thrown, handle it with your Error method and set returned message to Literal.
Console.WriteLine is not usable in ASP.NET. Use Debug.WriteLine instead. It will write to Output window in VisualStudio.
Many of the answers are dancing around the issue. Console.WriteLine is a command used to output a line of text for a Console application (command-line). This is a Web app. So, you either use Response.Write to spit a string out to the Response stream or set the text of a Literal control that is already on the page and set it to be visible (default hidden).
Since I myself completely missed the UpdatePanel detail, here's an alternate solution to make up for it. My example uses a hidden div and some jQuery through the usage of the ScriptManager control to inject text into a div that is outside the UpdatePanel. Based on the conditions of the go_Click handler method of the button, it'll show or hide an error message using jQuery that gets injected into the Page server-side at the time of the UpdatePanel's update.
Note that it is critically important to use the ScriptManager's functions to register JavaScript rather than Page.ClientScript when using AJAX. Using the latter won't add the JS to the page.
Page markup
<div id="errorMessagePlaceHolder" class="error" style="display:none;">
</div>
<asp:UpdatePanel ID="myPanel" runat="server">
<ContentTemplate>
<asp:TextBox ID="myText" runat="server" />
<asp:Button ID="go" Text="GO" runat="server" OnClick="go_Click" />
</ContentTemplate>
</asp:UpdatePanel>
Page code-behind
public partial class _Default : Page {
protected void go_Click(object sender, EventArgs e) {
try {
// Do something that can throw an exception
// Hide the error if we reach the end as we may have triggered
// it in a prior update and no longer want it to display.
HideError();
} catch (Exception) {
ShowError("myText is empty!");
}
}
#region Move to a base page or a helper class if it helps reduce duplication
private void HideError() {
ScriptManager.RegisterStartupScript(Page, GetType(), "HideErrorMessageScript", HideErrorMessageScript(), true);
}
private void ShowError(string errorMessage) {
ScriptManager.RegisterStartupScript(Page, GetType(), "ErrorMessageScript", ErrorMessageScript(errorMessage), true);
}
private static string HideErrorMessageScript() {
return #"
$(document).ready(function() {
$('#errorMessagePlaceHolder').hide();
});
";
}
private static string ErrorMessageScript(string errorMessage) {
return
string.Format(
#"
$(document).ready(function() {{
$('#errorMessagePlaceHolder').html('{0}');
$('#errorMessagePlaceHolder').show();
}});
",
errorMessage);
}
#endregion
}
I feel like nobody has actually answered the entire question yet, so let me try.
Is this Console.Writeline suitable for what i'm trying to do?
Probably not, unless you just want debug information to appear in the output window while debugging. Some people like to keep outputting info to the Console, even in a release build and so if you want to do that with your errors, it's a valid choice, but you should also be showing a friendly error message to the user and/or logging the error to some kind of persistence (eg. log file). All of the answers above are suggesting ways for you to show some notification of the error to the user.
Is this going to work on UpdatePanels?
There is NO reason why it shouldn't if your triggers and the like are set up properly (and we know they are because you said that you're able to hit the Console.WriteLine breakpoint). I wonder if your Console output is working fine but you're looking for it in the wrong place? In the typical configuration for a web application, it should appear in the Output window of the Visual Studio instance you're using to Debug.
As to a suggestion for what I think you're asking, which is "how do I get my error message to appear in the update panel if there's an error loading the content for that update panel?"...
I would suggest an approach similar to nekno's proposal above. You can either dynamically add a control whose text you can set to be the error string during update panel request processing or you can even have an initially hidden/collapsed control on the page, which is only set to be visible in the case of an error. I'd prefer the latter approach because it's more maintainable. You can completely control the look and feel of the error label from the markup/display views of your ASPX page.
Are you calling .update() on your UpdatePanel after your LoadData() method runs? I think the UpdatePanel won't automatically fire unless the postback originates from inside it.
Ex:
Protected void btnLoad_Click(object sender, EventArgs e)
{
LoadData();
MyUpdatePanel.Update();
}
Update: I was able to get Response.Write() to work in an UpdatePanel by registering a trigger like this <Triggers><asp:PostBackTrigger ControlID="btn1" /></Triggers> for the button that will create the error.
Are you trying to log errors or display them? If you are trying to display them, you should:
On your masterpage, create a spot where your errors will be displayed (maybe below your navigation bar or near the bottom:
<asp:ContentPlaceHolder id='cphError'></asp:ContentPlaceHolder>
Everytime you get an error, you can call your error function as is, but instead of writing out the text with Response.Write() or Console.WriteLine(), you can add a label in there:
Label lError = new Label();
lError.CssClass = '..';
lError.Text = '..';
cphError.Controls.Add(lError);
This will help you out with displaying the error, but AJAX will still be a problem. At this point, you have two options:
Since update panels update other update panels, you can wrap an update panel around cphError, this way your AJAX calls will still update that area
OR: You can can use ClientScript.RegisterStartupScript to create the error label. (This method is only preferable if you do not have a static error message spot)
Place a Panel on the master, extend it with the modalpopupextender in the AjaxToolKit. When the error is raised, write the contents of string writer to a label in the panel E.g. Label lbl = (Label)Master.FindControl()
lbl.text = StringWriter.ToString();
// Now access the modal popup
AjaxControlToolkit.ModalPopupExtender MPE = (AjaxControlToolkit.ModalPopupExtender)Master.findControl("");
// and show it
MPE.Show();
The Modal will need a hidden button to use as it's target control, but it will not require a user's input. I accomplish this on the page with the following code:
<asp:Button ID="btnDummyOK" runat="server" Style="display: none;" />
<asp:ModalPopupExtender ID="mpePnlErrors" runat="server" TargetControlID="btnDummyButton" PopupControlID="pnlErrirs" BackgroundCssClass="modalBackground" CancelControlID="btnCancel" OkControlID="btnOK" />
Good luck
I think Console.WriteLine don''t work on asp.net application and i think inside an update panel you can simple fire the throw New Exception( the friendly error message) and it will appear in an alert box.
Related
I am getting an error while trying to display an error message using Label control on asp.net form
what I am trying to do:
I want to show an error message using a Label control, if a user click on Submit button without selecting an option given in dropdown control and textbox control.
What I have done:
I have put code on .aspx is lblControl.Visible="true" and code on aspx.cs is inside Page_load- if(!isPostBack){ lblControl.Visible="false";
Then where I have handled the click->
if((txtbox.Text == "") & (ddlbox.SelectedItem.Text == "Select"))
{
string Message = "Please select a value in drop down list, other than 'Select' and fill some value in text box.";
lblControl.Visible = true;
lblControl.Text = Message;
/* I have tried this one code also
Page.ClientScript.RegisterStartupScript(this.GetType(), "errMsg", script, true); //doesn't help */
}
else{
save(); //another method to perform insert operation.
}
What is happening now: (As per my debug observation)
Whenever I am trying to display error message in the form of Label(control). The flow of program goes to Master page rather than display of Error message.
At the master we have placed various links related to show `logo image, ` logout link` etc `inside <%=Page.ResolveUrl("~/Modules.aspx")%>`
From there, debugging has halted & page has rendered without the message of lblContorl.
Confusion-cum-question: I am unable to understand this code-switch (flow of code getting child pages to Master pages)
many thanks for all types of suggestion!
Try the following:
Change your code to:
if(String.IsNullOrWhiteSpace(txtbox.Text) || ddlbox.SelectedItem.Text == "Select")
{
string message = "Your Error Message";
lblControl.Text = message;
lblControl.Visible = true;
return; // optional
}
else
{
save(); //another method to perform insert operation.
}
What this does is if one or both statements are true, this code will be executed. In case you do not want any other code to run after this, add 'return;' after the last line of code in your if-statement.
Another way of showing errors in ASP.Net would be to use a ValidationSummary.
With this, you do not have to worry about making controls visible or not.
Just add a ValidationSummary on your page where your Label is now - like this:
<asp:ValidationSummary runat="server" ID="myValidationSummary" CssClass="my-error-class" />
and change your code to:
if(String.IsNullOrWhiteSpace(txtbox.Text) || ddlbox.SelectedItem.Text == "Select")
{
string message = "Your Error Message";
ModelState.AddModelError("", message);
return;
}
else
{
save(); //another method to perform insert operation.
}
This way, there is no need to handle visibility and you can use this for DataBound Controls as well, so it might be worth looking into it.
EDIT: To use ModelState, you need to import ModelBinding. Just add:
using System.Web.ModelBinding;
to your Page. You can even use this in UserControls by simply calling
Page.ModelState.AddModelError("","Your Error Message");
You should be able to use this in ASP.NET without any problems.
I am unable to understand this code-switch (flow of code getting child
pages to Master pages)
See this Link to read about the ASP Page Lifecycle.
I have visited the Telerik's website and viewed their demos etc...
But I am having problems trying to load content (html) in the RadEditor.
I have a Button_Click event where I get my html string and then set it to the RadEditor. The RadEditor is inside a RadWindow and only becomes visible when the button is clicked.
protected void btnSubmitHtml_Click(object sender, EventArgs e)
{
RadEditor1.Content = "<p>hello there</p>";
RadWindow1.Visible = true;
}
This doesn't show the html inside the RadEditor for some odd reason. I suspect it is the page life cycle that is involved with this problem.
Are there any suggestions to solve this?
I have encountered this problem multiple times and never found a "Proper" resolution.
However, a great work around is to simply set the content from the clientside via injected script. The end result is the same, and if you can tolerate the 10 millisecond delay, worthy of consideration.
EDIT after comment requested reference
Basically all you need to get an instance of the editor using ASP.NET WebForms $find function. That takes the html ID of the root of the rendered object and returns the client side viewModel if one exists.
The $(setEditorInitialContent) call at the end assumes that jQuery is present and delays the execution of the function till page load.
<telerik:radeditor runat="server" ID="RadEditor1">
<Content>
Here is sample content!
</Content>
</telerik:radeditor>
<script type="text/javascript">
function setEditorInitialContent() {
var editor = $find("<%=RadEditor1.ClientID%>"); //get a reference to RadEditor client object
editor.set_html("HEY THIS IS SOME CONTENT INTO YOUR EDITOR!!!!");
}
$(setEditorInitialContent);
</script>
Take a look here to see how to get a RadEditor to work in a RadWindow: http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-radeditor-in-radwindow.html.
Said shortly, here is what you need to have in the OnClientShow event of the RadWindow:
function OnClientShow()
{
$find("<%=RadEditor1.ClientID %>").onParentNodeChanged();
}
To edit Html code only you can add -
EnableTextareaMode="true"
Add this property to the RadEditor.
I suspect that the way the control tries to interpret the html might be one of the problems. The other thing that may be causing this problem is the page life cycle.
I have a Web Form project I am developing C# ASP.Net 4.5. I have a class that calls a response.write to display a message for user input validation purposes. The call to response.write is made inside the class in a method from creating a new instance of the class, thus the class method, by pressing a button on the form. But using the response.write causes the textboxes on my page to shrink considerably. Then when I press a different button the textboxes go back to normal. It only happens when I use response.write. Any help would be appreciated. Code call in class method:
HttpContext.Current.Response.Write("File not found");
By using that you're simply dumping text to the top of the page, typically outside of the <html> tags. This can have a knock-on effect to the rest of the pages style; i see the same when i am spitting out test responses.
Instead, put yourself a label control on your page and populate that instead. you can put it exactly where you want and simply call:
So put this: <asp:Label runat="Server" id="myLabel" /> where you want the message to appear.
Then in your code-behind, write this. It will populate the label with the given text.
myLabel.Text = "File not found";
The Label control will be rendered as a <span></span> - so styling it is nice and easy.
If you fancied using a <div> then use the Panel control.
If you're not fussed about any sort of style, go for a Literal control, which renders no html elements.
When you use the HttpContext.Current.Response.Write on code behind is direct send to the page your text, at any random point of page render.
Maybe on top, maybe on bottom, on some point that you can not control if you use the code behind to call it.
Change the way you show your message, at a minimum you can use a literal control to render there your output and show it.
You may want to use a control to display your error. For example:
In the aspx/ascx
<asp:Label id="ErrorMessage" runat="server" />
in the page/control code behind
//call TheClass
TheClass c = new TheClass();
string error = c.TheMethod();
if (!string.IsNullOrEmpty(error))
{
ErrorMessage.Text = error;
}
in TheClass
public class TheClass
{
public string TheMethod()
{
string result = "";
...
//When file is not found
result = "File not found";
...
return result;
}
}
In an asp.net windows forms application, in the C# code behind you can use:
MessageBox.Show("Here is my message");
Is there any equivalent in a asp.net web application?
Can I call something from the C# code behind that will display a message box to the user?
Example usage of this: I have a button that loads a file in the code behind. When the file is loaded or if there is an error I would like to popup a message to the user stating the result.
Any ideas on this?
You want to use an Alert. Unfortunately it's not as nice as with windows forms.
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true);
Similar to this question here: http://forums.asp.net/t/1461308.aspx/1
Or create a method like this in your solution:
public static class MessageBox {
public static void Show(this Page Page, String Message) {
Page.ClientScript.RegisterStartupScript(
Page.GetType(),
"MessageBox",
"<script language='javascript'>alert('" + Message + "');</script>"
);
}
}
Then you can use it like:
MessageBox.Show("Here is my message");
Here is a link from Microsoft that I think is the best way to present a MessageBox in ASP.NET
Also it presents choices like Yes and No.
Instructions on how to get the class from the link working on your project:
If you don't have an App_Code folder on your Project, create it.
Right click the App_Code folder and create a Class. Name it MessageBox.cs
Copy the text from the MessageBox.cs file (from the attached code) and paste it on your MessageBox.cs file.
Do the same as steps 2 & 3 for the MessageBoxCore.cs file.
Important: Right click each file MessageBox.cs and MessageBoxCore.cs and make sure the 'Build Action' is set to Compile
Add this code to your aspx page where you want to display the message box:
<asp:Literal ID="PopupBox" runat="server"></asp:Literal>
Add this code on you cs page where you want to decision to be made:
string title = "My box title goes here";
string text = "Do you want to Update this record?";
MessageBox messageBox = new MessageBox(text, title, MessageBox.MessageBoxIcons.Question, MessageBox.MessageBoxButtons.YesOrNo, MessageBox.MessageBoxStyle.StyleA);
messageBox.SuccessEvent.Add("YesModClick");
PopupBox.Text = messageBox.Show(this);
Add this method to your cs page. This is what will be executed when the user clicks Yes. You don't need to make another one for the NoClick method.
[WebMethod]
public static string YesModClick(object sender, EventArgs e)
{
string strToRtn = "";
// The code that you want to execute when the user clicked yes goes here
return strToRtn;
}
Add a WebUserControl1.ascx file to your root path and add this code to the file:
<link href="~/Styles/MessageBox.css" rel="stylesheet" type="text/css" />
<div id="result"></div>
<asp:ScriptManager runat="server" ID="scriptManager" EnablePageMethods="True">
</asp:ScriptManager> //<-- Make sure you only have one ScriptManager on your aspx page. Remove the one on your aspx page if you already have one.
Add this line on top of your aspx page:
<%# Register src="~/MessageBoxUserControl.ascx" tagname="MessageBoxUserControl" tagprefix="uc1" %>
Add this line inside your aspx page (Inside your asp:Content tag if you have one)
<uc1:MessageBoxUserControl ID="MessageBoxUserControl1" runat="server" />
Save the image files 1.jpg, 2.jpg, 3.jpg, 4.jpg from the Microsoft project above into your ~/Images/ path.
Not Really. Server-side code is happening on the server. You can use JavaScript to display something to the user on the client side, but it obviously will only execute on the client side. This is the nature of a client server web technology.
You're basically disconnected from the server when you get your response.
Why should not use jquery popup for this purpose.I use bpopup for this purpose.See more about this.http://dinbror.dk/bpopup/
There are a few solutions; if you are comfortable with CSS, here's a very flexible solution:
Create an appropriately styled Panel that resembles a "Message Box", put a Label in it and set its Visible property to false. Then whenever the user needs to see a message after a postback (e.g. pushing a button), from codebehind set the Labels Text property to the desired error message and set the Panel's Visible property to true.
'ASP.net MessageBox
'Add a scriptmanager to the ASP.Net Page
<asp:scriptmanager id="ScriptManager1" runat="server" />
try:
{
string sMsg = "My Message";
ScriptManager.RegisterStartupScript(Page, Page.GetType, Guid.NewGuid().ToString(), "alert('" + sMsg + "')", true);
}
As others already pointed out, a message box will be clientside Javascript. So the problem then is how to force a clientside JS message box from the server side. A simple solution is to include this in the HTML:
<script>
var data = '<%= JsData %>';
alert(data);
</script>
and to fill this data from the server side code-behind:
public partial class PageName : Page
{
protected string JsData = "your message";
Note that the string value should be a Javascript string, i.e. be a one-liner, but it may contain escaped newlines as \n.
Now you can use all your Javascript or JQuery skills and tricks to do whatever you want with that message text on the clientside, such as display a simple alert(), as shown in the above code sample, or sophisticated message box or message banner.
(Note that popups are sometimes frowned upon and blocked)
Note also that, due to the HTTP protocol, the message can only be shown in response to an HTTP request that the user sends to the server. Unlike WinForm apps, the web server cannot push a message to the client whenever it sees fit.
If you want to show the message only once, and not after the user refreshes the page with F5, you could set and read a cookie with javascript code. In any case, the nice point with this method is that it is an easy way to get data from the server to the javascript on the client, and that you can use all javascript features to accomplish anything you like.
Here's a method that I just wrote today, so that I can pass as many message boxes to the page as I want to:
/// <summary>
/// Shows a basic MessageBox on the passed in page
/// </summary>
/// <param name="page">The Page object to show the message on</param>
/// <param name="message">The message to show</param>
/// <returns></returns>
public static ShowMessageBox(Page page, string message)
{
Type cstype = page.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = page.ClientScript;
// Find the first unregistered script number
int ScriptNumber = 0;
bool ScriptRegistered = false;
do
{
ScriptNumber++;
ScriptRegistered = cs.IsStartupScriptRegistered(cstype, "PopupScript" + ScriptNumber);
} while (ScriptRegistered == true);
//Execute the new script number that we found
cs.RegisterStartupScript(cstype, "PopupScript" + ScriptNumber, "alert('" + message + "');", true);
}
if you will include
System.Windows.forms
as namespace then it will conflict .
Use
btn_click()
{
System.Windows.Forms.MessageBox.Show("Hello");
}
You need to reference the namespace
using System.Windows.Form;
and then add in the code
protected void Button1_Click(object sender, EventArgs e)
{
MessageBox.Show(" Hi....");
}
Right click the solution explorer and choose the add reference.one dialog box will be appear. On that select (.net)-> System.windows.form. Imports System.Windows.Forms (vb) and using System.windows.forms(C#) copy this in your coding and then write messagebox.show("").
Just add the namespace:
System.Windows.forms
to your web application reference or what ever, and you have the access to your:
MessageBox.Show("Here is my message");
I tried it and it worked.
Good luck.
I have an asyncfileupload control inside an update panel. The file succesfully upload and fires the correct server side code. The code on the server is exected as expected however, one line in the server code changes the text on a label. I step through the code in debug mode and the line is executed but no change is made to the page.
Here's some of the code:
<asp:UpdatePanel runat="server" ID="updater" >
<ContentTemplate>
<asp:AsyncFileUpload ID="fileUpload" runat="server" OnUploadedComplete="FileUploadComplete" />
<asp:Label ID="AsyncText" runat="server" Text="File Type not checked" />
</ContentTemplate>
</asp:UpdatePanel>
public void FileUploadComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
System.Threading.Thread.Sleep(500);
if(fileUpload.HasFile) { AsyncText.Text = "file of correct format: "; }
}
Can anyone help me with solving this problem or offering annother solution??
Thanks
I think you are going to have to move toward a different solution. From your label message, it looks like you are trying to check the file type, correct? Basically, the AsyncUplaod control, although posting back to get the uploaded file to the browser, is not actually updating the page's viewstate, thus the label never gets updated. Boo! I was able to visualize this using this code in the page load event.
if (Page.IsPostBack)
{
if (Request.Files.Count > 0)
{
AsyncText.Text = "file of correct format";
ListItem item = new ListItem("item to add");
lb.Items.Add(item);
}
}
This was allowing me to set the label text but still nothing changed until I clicked on a random button that I added to the page. This button didnt even have an event in the code behind, but it was enough to cause a normal postback, and the label text and list item were successfully updated/added to the list. With that said, I would wait to update any labels until the user clicks upload by using a seperate upload button. (ie use the AsyFileUplaod to get it to the browser, but another button to save the file to the server). You can always do file evaluations in the button click event by referencing the posted files to the webpage as I did in the code above.
Some other examples I found online were using javascript to change the label text which works well also. Somthing like this:
string message = "";
if (e.StatusMessage == "Success")
{
message = "File upload successful;";
}
else
{
message = "File did not upload successfully;";
}
ClientScript.RegisterStartupScript(this.GetType(), "akey", "document.getElementByID('label').value =" + message, true);
Another example: here
I think in this case it's just the nature of the control and the only way to achieve what you want is though some creative thinking. If you have any other questions about anything I listed here feel free to ask.
Good luck!
Where is the label positioned, inside or outside the update panel? Seems like the partial page update may not be including the update to the label text. I would say move the label around as the simplest suggestion, but you could also try something like RegisterStartupScript which will change the lable text via javascript. This should still give you server side control over what text to display based on what happens during the upload.
If you could post some code that would be great.