循环线程,更新文本框值. [英] loop thread , updating textbox value.

查看:93
本文介绍了循环线程,更新文本框值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我尝试建立一个asp.net聊天室,我只是有一个大问题,我有一个文本框[或者我可以使用列表框代替]线程数据库表,一些文本框和按钮.
此线程具有连接到数据库并获得最新消息的代码(如果消息数量超过文本框中的消息计数),并将其添加到文本框中,问题是文本框未显示任何内容,我不想刷新页面,因此我没有使用计时器,我的一些朋友告诉我使用更新面板,但是我不认为这是正确的方法,甚至我也没有使用它,但是当我使用计时器时,它可以工作,但是我不需要刷新页面.
所以我该怎么办?

hi all
i try to make a asp.net chat room, i just have a little BIG problem,i have a textbox [or i can use list box instead] a thread a database table, an some textbox and buttons.
this thread have codes that connects to DB and get the latest messages if the number of messages are more than messages count in textbox, and add them to textbox, the problem is that textbox didnt show anything, i dont want to refresh the page , therefor i didnt use timer, some of my friends told me to use update panel , but i dont think its the correct way, and even i used it and get nothing, but when i use the timer, it works, bu i dont need to refresh the page.
so what should i do?

推荐答案



您说您正在开发应用程序中的聊天应用程序.您的想法很好,但是在开发聊天应用程序时这不是正确的方法.它在传输数据时使用网络中的高带宽.使用Jquery从数据库中检索最后一个味精,然后检查味精是否持久如果两个相等,则检索msg id,否则将数据发送到浏览器.

在客户端jquery中,将检索到的msg附加到特定的msgbox.

使用jquery的单个聊天应用程序的源代码太多了

这里''m提供了一些到jquery中简单聊天应用程序的链接.

http://net.tutsplus.com /tutorials/javascript-ajax/how-to-create-a-simple-web-based-chat-application/

http://www.codeproject.com/KB/applications/AliAspNetChat.aspx


如果使用jquery,则无需刷新页面
一切顺利
Hi,

You said you are developing chat application in your application.your thinking is fine But that is not correct way while developing chat application .It uses high bandwidth in network while transfering data .Use Jquery for retrieving last msg from database thn check that msgid to last retrived msg id if two equal ignore otherwise send data to browser.

In client side jquery appends that retrieved msg to particular msgbox.

There are so many source codes for individual chat applications using jquery

Here ''m providing some links to simple chat application in jquery.

http://net.tutsplus.com/tutorials/javascript-ajax/how-to-create-a-simple-web-based-chat-application/

http://www.codeproject.com/KB/applications/AliAspNetChat.aspx


If you use jquery no need to refresh your page
All the best


这篇关于循环线程,更新文本框值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆