0

I am working with a serial port device in asp.net.It works in different thread than UI thread.In its event I want to get access to my textbox and change its value.

void posInfo(string smth)
{
txtUI.text = smth;
}

this is giving me exception. how can i achieve this?

Cœur
  • 37,241
  • 25
  • 195
  • 267

2 Answers2

1

HTTP is disconnected protocol and the time your thread would send data you will not have connections to clients You will have to use some pooling solution using javascript timer with Ajax for updating the textbox asp.net. or you can use Web scoket to update the GUI

Community
  • 1
  • 1
Adil
  • 146,340
  • 25
  • 209
  • 204
0

After the page is already rendered, you won't be able to change the textbox value. You'll have to do it with ajax or maybe something like signalr.

Kevin Up
  • 791
  • 1
  • 6
  • 11