Help needed for InvokeRequired for Web.UI

I have a multithreaded C # application that is trying to write to a TextBox on Windows.Forms created by another thread.

Since threads cannot change what was not created by them, I used InvokeRequired as shown in the code below to solve this problem.

public delegate void MessageDelegate(Communication message);
void agent_MessageReceived(Communication message)
{
   if (InvokeRequired)
   {
       BeginInvoke(new MessageDelegate(agent_MessageReceived), new object[] { message });
   }
   else
   {
      TextBox1.Text += message.Body;
   }
}

Now I need to do the same for a TextBox in an ASP.NET application, but apparently neither an InvokeRequired nor BeginInvoke exists for a TextBox in Web.UI. What can I do?

+3
source share
2 answers

, , . - , ? ? , , -, .

, , InvokeRequired Invoke, ASP.NET . , -, .

. - - , .

0

, -. TextBox, WebServer TextBox . - ?

+2

Source: https://habr.com/ru/post/1740671/


All Articles