C# ajax update textbox




















Tuesday, July 29, PM. I guess your methods are synchronous and blocking? You could run them on a different thread as tasks using async await. Then when you set the text property the ui thread is not blocked and you would see the change.

I just knocked together some code on another thread.. This Task returns stuff back to the UI thread when you await it. So calling that: Textbox. What that does is sets your text on the textbox and cranks up another thread - a Task. It goes off and does it's stuff. When complete control returns to the statement after the await. Something like: Textbox. I inherited this program, so I will refactor it to use a TextBlock. Also your post method on the server should accept an object and not 2 parameters unless you want to change your ajax to send it by url instead.

Actually I tried to debug in the controller. There is a method in Ajax and if it hits atleast in it, then I could understand. Right now, trying to solve it. I was not very clear, sorry.

I assumed the code was not reaching your ajax call in the javascript and that is where you were putting your breakpoint. That is step 1, see if your ajax call is even firing. You need to do that from the browser. You can debug it with a breakpoint or see what if any the network activity is from the browser. Once you get that to fire then figure out if or why not its hitting the controller. I've put the breakpoint in the controller to see if it passes the associated id and quantity for a specific product.

But it doesn't fire up. You need to see if it is not being hit because you are 1 calling it wrong or 2 not calling it at all. You do this from the browser. You can debug your javascript in the browser using the debug tools provided in the browser. Show 2 more comments. Active Oldest Votes. Improve this answer. Add a comment. Developer Developer 5, 2 2 gold badges 17 17 silver badges 24 24 bronze badges.

Sign up or log in Sign up using Google. Invoke handles synchronizing the change when it can through the UI thread that the form us running on. The thread method. Invoke is a method within the form class, so you may need to pass the instance of your form object to your thread class if you have your thread method in a different class.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Updating a Textbox with current variable value Ask Question. Asked 6 years, 11 months ago. Active 6 years, 11 months ago. Viewed 11k times. Timer ; myTimer. Start ; private void myTimerElapsed object sender, System. ToString myThread.



0コメント

  • 1000 / 1000