.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

updating label in an UpdatePanel

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
I either don't understand or I'm not using AJAX right.  I'm running a long report.  I'd like to have a label to show the user that the "Report Running", then, that the report has finished.  But, when the user runs another report, I'd like to have the label that shows "Report Finished!"  to clear so that you don't have "Report Running!" and "Report Finished!" on the screen at the same time.  But, the label will not clear????  I get both lables showing.  What am I doing wrong? Here is a sample:     <asp:UpdatePanel ID="UpdatePanel2" runat="server" >    <Triggers>    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /><asp:AsyncPostBackTrigger ControlID="Button1" EventName="click"></asp:AsyncPostBackTrigger>    </Triggers>    <ContentTemplate>       <asp:Label ID="lblMsg2" runat="server" style="font-size: xx-large; font-weight: 700" Text=""></asp:Label><br />                   <br />      &n

View Complete Post

More Related Resource Links

Updating a label twice during a postback


I am updating a label as part of an imagelabel click using an update panel as this process can take some time. What I would like to do is update the label at the start of the processing so that when the user clicks it says 'procsessing...' and when it finishes processing it says 'done'

I thought I would be able to do this by calling the following:

btnClockIn.Attributes.Add("onClick", "return clearstatus();")

and then using the foolowing script on my webpage:

function clearstatus() {
    form1.lblStatus.value = "";
    document.getElementById("lblStatus").innerHTML = "change in text or whatever";
    return true;

But this doesn't seem to do anything (I have tried setting .value as well)

Is there some way that I can update a label more than once during postback?


Noob question about updating label.


I'm having a label in a page which I need to be updatet multiple times when a method in the codebehind file fires, like this:

protected void updateLbl()


lbl1.Text = "test1";


lbl1.Text += "test2";


but the label first updates when the method finishes. How can I solve this? Do I need AJAX?

Thanx in advance.

Updating an ASP.NET CheckBoxList inside an UpdatePanel from a Javascript function



I have a asp.net listbox server control that is connected to a jquery plugin that can handle a client side click event for each of the checkboxes it renders.

Whenever I click on a checkbox the click event gets triggered and I make a call to

__doPostBack("UpdatePanel1"""); so that i can update the updatepanel and rebind the checkboxlist inside it.

is it possible to do the rebind first, and then update the updatepanel? how do i do that? because now, the rebind happens on the second time i click on the checkbox.




    <script type="text/javascript">
        $(function () {

Nested updatepanel updating all the update panel



I have one update panel which is having tPlaceholder which is loading dynalically.

<asp:UpdatePanel ID="UpdatePanel_ForumContent" runat="server" UpdateMode="Conditional">
            <asp:PlaceHolder ID="ForumTopicPlaceHolder" runat="server" Visible="true"></asp:PlaceHolder>

in the CS file on page load, adding Placeholder dynalically

 Control ForumTopicTabControl = LoadControl("Topic.ascx");
                Assembly objAssembly = BuildManager.GetCompiledAssembly("~/Topic.ascx");
                Type objType = objAssembly.GetType("Blogs_ForumTopic");
                PropertyInfo objProperty = objType.GetProperty("TableName");
                objProperty.SetValue(ForumTopicTabControl, dr["TopicTableName"].ToString(), null);
                objProperty = objType.GetProperty("HeaderName");
                objProperty.SetValue(ForumTopicTabControl, dr["Name"].ToString(), null);
                objProperty = objType.GetProperty("HeaderDesc");
                objProperty.SetValue(ForumTopicTabControl, dr["Description

ToolkitScriptManager fails on updating UpdatePanel


Hello everyone,

this is my first post in this forum, even though I often search for helps and clarifications over its threads. And many times they are definitely useful!!

I had a <asp:ScriptManager> in may MasterPage, wich was used to manage various UpdatePanels I have either in Content pages or in  MasterPage.

Today I inserted a CalendarExtender, so I had to replace the ScriptManeger with the AJAX ToolkitScriptManager.

At the beginning it seemed to work fine (the calendar pop up and others controls got updated properly). Then I noticed that the nodes in various TreeView are not expanding any more. 

The TreeViews objects are placed inside an UpdatePanel, in order to expand each node without refreshing the whole content page. And, while a node expands, an UpdatePanel containing a GridView in the content page gets updated.

Now, with the new ScriptManager they do not expand, but when clicking on a single node the GridView is updated properly.

Here some pieces of code:

<asp:ToolkitScriptManager ID="SM_Tree" runat="server" EnablePartialRendering="true" EnableScriptGlobalization="true" CombineScripts="false">

TSM in MasterPage


Updating updatepanel before postback completes



I'm running some server code that generates a bunch of status lines to the user. However, even though this is on an updatepanel, nothing happens before the function completes. Not really a surprise. However, I would like to be able to somehow update this field so that the user can see something actually happning while they wait.

Anyone know of a good way to do this?

Cheers! :)

UpdatePanel is not a known element - message when upgrading to 1.0 ajax


It worked on one of my old pages.  I change the web.config, renamed all the <asp.

On some aspx page it doesn't recognize the updatepanel.  It only does on one page.  If I create a new aspx page with a different name - then it works.

Should I just create a new web project ajax - then copy all my code into there?  Or is there a way to get those old pages to recognize the new ajax controls?

Gridview inside updatepanel


I am displaying large amount of data in gridview,the gridview placed within updatepanel,every 1sec i am refreshing updatepanel using ajax timer.my problem is while displaying large data the cpu performance is low,pls give idea to increase cpu performance..

Error when updating. Supposedly updating ID without being asked.



Server Error in '/' Application.

Value of member 'ID' of an object of type 'Ref' changed.
A member defining the identity of the object cannot be changed.
Consider adding a new object with new identity and deleting the existing one instead.

I get this error whenever I attempt to update an entry. Even an entry that has had nothing altered. I have tried to circumvent it but I think it must be a simple oversight. How could I have caused an ID update using the Edit.aspx page of dynamic data? Thank you in advance for the help!

Print row count on Label



I have an SP that simply performs a COUNT(*) from a table. I'm am trying to print that number in an ASP Label. It works in Query analyzer but I cant wrap my head around how to display it in a label. Any guidance much appreciated. 

Thank you. 

How to display a count of search results with keywords in a label?


Sorry for a basic post here; I am very new to VB!

I am currently building a search page, which includes a textbox and two drop-down lists, a search button, and a datagrid. If results are found and displayed, I would like a label to display:

(e.g.) "24 results found for 'blue sky clouds' "

...where the integer represents the results count, and the keywords and/or drop-down list selections are included in the string.

If no results are found I would like the label to display:

(e.g.) "No results were found that match your selection. Please try again"

I would also like the label to be invisible until a search occurs.

Thanks in advance!

Wicked Code: UpdatePanel Tips and Tricks


Jeff Prosise explains when it's better to use UpdatePanel and when it's better to use asynchronous calls to WebMethods or page methods instead.

Jeff Prosise

MSDN Magazine June 2007

Data Points: Updating Data in Linked Servers, Information Schema Views, and More


Every day a developer somewhere needs to write code to iterate through SQL ServerT system objects, query and update tables in linked servers, handle optimistic concurrency, and retrieve column and stored procedure metadata.

John Papa

MSDN Magazine November 2004

Timers: Implement a Continuously Updating, High-Resolution Time Provider for Windows


The timestamps that you can obtain from Windows NT are limited to a maximum resolution of 10 or 15 milliseconds, depending on the underlying hardware. At times, such as when you need to timetag frequent events, it is desirable to achieve a higher resolution. For example, what if you want to be able to contact a thread or perform some other task at intervals more frequent than 10 milliseconds? Suggested ways of achieving better resolution include using performance counters in conjunction with the sytem time to calculate smaller time increments. But using performance counters is a technique that presents its own problems. This article shows one possible way of overcoming limitations inherent in this approach.

Johan Nilsson

MSDN Magazine March 2004

BITS: Write Auto-Updating Apps with .NET and the Background Intelligent Transfer Service API


Both the .NET Framework and Windows have some very interesting APIs for creating applications that are capable of updating themselves automatically over a network. There are many advantages to writing your application to update itself like Windows Update does, including convenience for your users, from easier maintenance to network administration. Automatic updates require attention to factors such as discovery, security, and file replacement. In this article, the author covers the BITS API as well as a number of features of the .NET Framework that take care of these facets of auto-updating using the same facilities that the Windows Update uses.

Jason Clark

MSDN Magazine February 2003

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend