Click here to Skip to main content
15,904,155 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

I used this piece of code in an app in C# and need to
use it now in Asp.Net, but don't know how to code it
in Asp.Net. Here is the code:

C#
if (lblStatus.InvokeRequired)
                lblStatus.Invoke(new MethodInvoker(delegate { lblStatus.Text = temp.DataBlock.ToString(); }));


Please help me with this!!
Posted
Updated 29-Nov-11 18:39pm
v2
Comments
Karthik Harve 30-Nov-11 0:35am    
Objective is not very much clear. explain some more about the issue..
Sergey Alexandrovich Kryukov 30-Nov-11 0:39am    
It is not clear, but the answer is pretty obvious. Will you see mine?
--SA
Ben Paxton 30-Nov-11 0:47am    
Its throwing errors on InvokeRequired, Invoke, MethodInvoker
Ben Paxton 30-Nov-11 0:49am    
Just help me get a solution please, just need to get this working
Sergey Alexandrovich Kryukov 30-Nov-11 0:38am    
What, Windows Forms?! It's brave! :-)
--SA

1 solution

Short answer: you cannot.

Strictly speaking, as you did not show fully qualified names in your code sample, so what I say is my guess, but this is unlikely something else. It looks like UI code, most likely using System.Windows.Forms. If has nothing to do with ASP.NET. Even though your could formally write it in the ASP.NET application, how the application host can run it? On the server side? Who will see it? :-)

The problem is not that you don't know how ASP.NET works. It looks like you have no idea how a Web application works, otherwise you would not ask such question.

You can do only one thing: totally redesing and rewrite all your UI in ASP.NET. Are you interested? Start from here: http://www.asp.net/get-started[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900