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

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

Noob question about updating label.

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net

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.

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?


Entity framework noob question

I have been struggling to understand how this works. In the image above i have these db tables generated by Entity Framework. Problem is it seems that when i use the code below to assign the location values obtained from a listbox to the division being created/edited EF creates a new location and then enters that locations id and the divisions is into the DivisionLocation table thus creating multiple locations unnecessarily, as depicted below. using (FRLEntities context = new FRLEntities()) { for (int i = 0; i < lstPicked.Items.Count; i++) { var lpn = cm.GetLocation(Convert.ToInt32(lstPicked.Items[i].Value)); Location cLocation = new Location { LocationId = Convert.ToInt32(lstPicked.Items[i].Value), LocationName = lstPicked.Items[i].Text, LocationParentName = lpn.LocationParentName }; //CurrentDivision.Location = new EntityCollection<Location>(); CurrentDivision.Location.Add(cLocation); } } Division Divisionid            DevisionName 1                            1st Division 2    &nb

Noob Question - Using Linq in View

I just inherited an MVC2 application. So far my only experience with MVC is reading the Nerd Dinner sample chapter and downloading the nerd dinner app. I do plan to dive much deeper but i need a quick answer because i have to hit the ground running. So basically in the main Index view the view model is being passed as an IQueryable. Then he is doing some queries on the view model to loop through the data. See example below:<% if (Model.Where(w => w.State == workflowStep.Key).Count() > 0) { %>To me, even though minor, this is business logic and shouldn't be in the view. Shouldn't any type of logic like this be sorted out before you get to the view? Or is this common practice in MVC?Basically i want to know if I should spend time refactoring this thing or just go with the flow.  Thanks.

updating label in an UpdatePanel

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

Question in row group not updating on when the column value changes

I'm using Report Builder 3.0 and created a row group column and then moved it to a row about the detail columns instead of leaving it as a column at the left.  When I run the report the group value doesn't change  but the page break occurs.  I added the same field as a column so I can see the value is different. Why is the row group field not changing?

question about gridview updating


Hello, i have some GridView Using LinqDataSource1 (GridView1). i want the gridview to update everytime the user make something on page so im using GridView.DataBind() in the Page_Load method on code behaind (isPostBack statement) and its working fine!!! (the user make something on view1 on Multiview and then jump to view2 to see the gridview) the problem is, when the user want to edit some row in the gridview (using the gridview commands) the data dont update!! he can only delete rows. when im removing the isPostBack statement its working and the user can update and delete but i need the isPostBack so the gridview will update his rows. any idea?????

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataKeyNames="userFileId" DataSourceID="LinqDataSource1" 
            ForeColor="#333333" GridLines="None" Width="540px" Font-Names="Arial" Font-Size="X-Small">
            <RowStyle BackColor="#EFF3FB" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="fileName" HeaderText="?? ?????" 

Some basic MVC question

  1. In regular asp net I can run (debug) the application but I can either "view in browser" that gives me the option to view the application and write code on same time.

In MVC I can't find this option.

  1. What is the basic DATA MODEL for working with SQL DB.

I mean with no any framework (entity framework, Sub sonic, Link to SQL etc')

I look for basic application that works with data but with no fw.

  1. What is the popular DB framework that working with data.
  2.  I am looking on  mvc series


C# Soup To Nuts  (the best series ever)


I watch some of the MVC video, seems that the music store is good but I have to wait to the other part.

Does any one know and recommend   a Microsoft MVC tutorial?





Web Site to Web Application Question


I've been building web sites and for my next project I will be creating a web application.  I use a 'BasePage' class in all my projects but, since web applications do not contain the 'App_Code' folder, what is the best place/practice for the 'BasePage' class?



connection string question from a newbie


when publishing  in the webmatrix dialogue it asks for "destination connection string" for my "database.mdf"

I was not sure what it was so I pasted this from my web.config file :

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database.mdf;Integrated Security=True;User Instance=True

it all published ok, but wont run, so I guess it has somthing to do with this connection string or some kind of configuration issue.

My question is this, What should go in the field for "Destination connection string"

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!

Security Question Answer Retrieval


I know there is a method built in for retrieving the encrypted password, but how do I retrieve the encrypted security answer?

What I want to do is have a member profile update screen that the end user can update their password and security question and answer. However, when they get to this page, I want to already be showing the security question (the easy part) and its answer (the not so easy part).

I have updated web.config with passwordFormat=Encrypted and have added a machineKey with the generator (forgot the link, but located on eggheadcafe somewhere).

I haven't done ANYTHING yet, since I already have a user store with hashed information. I wanted to get some functionality done before publishing, wiping the store and recreating users (only a couple developers).


Very Basic Question - Error message running first page


Hi Everyone,

I am running Windows 7 and I have gone into Control Panel and activated all of the IIS Functions.

The web application I am running was downloaded from the net (and has worked on other machines previously).  Once I downloaded it, I moved it into C:/inetpub/wwwroot/code/main.asp

I am a bit of a novice at this!  But I am hoping someone can point me in the right direction!


I get the following error when I try and run the web application through IE:

"An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error."

(When i click the "click here" button it just goes to the IIS site).


Appreciate any help I can get!




C#, LINQ: (List<>) Question???


Hi Everyone,

I have a strange problem:


There is an entity (Table) called "Filters" in my .edmx which has all my tables and stuff in it (to use it for LINQ queries)

I have created a class called "CustomFilters" which inherits "Filters". So now my cutom class has all the properties of the original "Filters" class (table) and 1 more additional property that i wanted which is a List of "CustomFilters":

List<CustomFilters> children = new List<CustomFilters>();

Now i get all my records into:

List<CustomFilters> theOriginalList = new List<CustomFilters>();

NOTE: first all records are tken into a List<Filters> and then these are added into List<CustomFilters> where List<CustomFilters> for children of that record is added, and then children of the child records, and so on......

so now, every record is an instance of CustomFilters which has a property named "children" which is a list again; and each child again has instanaces of "CustomFilters", and each instance again has children...and on and on and on.....

(basiacally its a data source for a treeview in my silverlight control)

every thing is good and working as expected.


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. 

linqdatasource parameters question



I'm currently getting to know the linqdatasource control. What would happen if several WHERE parameters are added to the linqdatasource control declaritively in the aspx page but no WHERE clause is defined? 

1. is there any issue with setting up multiple WHERE parameters in the aspx markup for linqdatasource but then deciding which ones actually get used at runtime by setting the actual WHERE clause at run time? Would the unused parameters simply be ignored and cause no issues?

2. when you need to modify WHERE clause or WHERE parameters at runtime do you need to do so in an event handler? such as linqdatasource.selecting?
I see from the above link it is possible, but is that the standard way to handle controlling filtering in code behind for linqdatasource?

2b. if you use an event such as linqdatasource.selecting to add where parameters and/or modify the where clause in code will that also break the builtin sorting and paging support of the linqdatasource with a gridview? 

database interface design question


For handy database interface, is it good to use SqldataSources exclusively intead of EntLib functions?

Thanks for any feedback.

A Challenging Question for Advanced user....


Using  dot net How will you release .exe applicattion for 1000 clients.this question was asked by manager but i could not answer him.tell me if you can!!!

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