Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
currently I'm developing a web chat using ASP.NET with Ajax. But the problem i using Ajax async postback to query database "chat" table. So as you can see the code portion in my Chat screen, i use updatepanel with timer trigger an async postback.
C#
<div id="chatdisplay" class="chatdisplay">
                        <asp:Timer ID="Timer1" runat="server" Interval="2000" ontick="Timer1_Tick"></asp:Timer> 
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                            <asp:AsyncPostBackTrigger ControlID="btnSend" EventName="Click" />
                        </Triggers>
                        <ContentTemplate>    
                        <asp:Table ID="chatPanel" runat="server" Width="100%"  CssClass="tableWidth">
                            </asp:Table>

                        </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>


But the problem happen when i run the program,i'm not able to highlight and copy the text in the chat display,,, because the chat display is refresh every 2 second.
Cant everyone point out my mistake either in the way i implement ajax in my web chat or the concept is wrong.
Posted
Updated 7-May-13 23:41pm
v2
Comments
Richard C Bishop 8-May-13 16:12pm    
Why not refresh it when a message is sent or recieved instead of being on a timer?

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