Re: The chat does not works

  •  09-28-2012, 7:58 AM

    Re: The chat does not works

    Hi Willemt,

     

    Please try the example below. It is the vb.net example.

     

    1. <%@ Page Language="VB" %>  
    2. <%@ Import Namespace="System.Data" %>  
    3. <%@ Import Namespace="System.Data.SqlClient" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5.   
    6. <script runat="server">  
    7.     Private Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs)  
    8.         If Not Me.IsPostBack Then  
    9.             Dim lobbies As ArrayList = New ArrayList  
    10.             For Each lobby As CuteChat.LobbyInfo In CuteChat.ChatApi.GetLobbyInfoArray  
    11.                 If ((lobby.Lobby.Integration = "") _  
    12.                             OrElse (lobby.Lobby.Integration Is Nothing)) Then  
    13.                     lobbies.Add(lobby)  
    14.                 End If  
    15.             Next  
    16.             Me.DataList_Lobbies.DataSource = lobbies  
    17.             AddHandler Me.DataList_Lobbies.ItemDataBound, AddressOf Me.rptLobbies_ItemDataBound  
    18.             Me.DataList_Lobbies.DataBind()  
    19.         End If  
    20.         If (CuteChat.ChatApi.GetLobbyInfoArray.Length < 1) Then  
    21.             Literal1.Text = "<p style='font-size:14px;'>There is no chat room availables now.<br><br>Please login as admin and cre" & _  
    22.             "ate chat rooms in the admin console!</p>"  
    23.         End If  
    24.     End Sub  
    25.       
    26.       
    27.     Private Sub rptLobbies_ItemDataBound(ByVal sender As ObjectByVal e As DataListItemEventArgs)  
    28.         If (e.Item.DataItem Is NothingThen  
    29.             Return  
    30.         End If  
    31.         Dim lobby As CuteChat.LobbyInfo = CType(e.Item.DataItem, CuteChat.LobbyInfo)  
    32.         Dim lnkLobby As HyperLink = CType(e.Item.FindControl("lnkLobby"), HyperLink)  
    33.         lnkLobby.NavigateUrl = (CuteChat.ChatWebUtility.ResolveResource(Me.Context, "Channel.Aspx") & ("?Place=Lobby-" & lobby.Lobby.LobbyId))  
    34.         lnkLobby.Target = "_blank"  
    35.         Dim sOnlineChater As String = lobby.JoinClient(",")  
    36.         Dim lblOnlineChater As Label = CType(e.Item.FindControl("lblOnlineChater"), Label)  
    37.         lblOnlineChater.Text = lobby.ClientCount.ToString  
    38.         lnkLobby.ToolTip = sOnlineChater  
    39.     End Sub  
    40. </script>  
    41.   
    42. <html xmlns="http://www.w3.org/1999/xhtml" >  
    43. <head runat="server">  
    44.     <title>chat room</title>  
    45. </head>  
    46. <body>  
    47.     <form id="form1" runat="server">  
    48.    <div class="infobox" style="width: 700px; margin: 30px auto">  
    49.             <h2>  
    50.                 Chat  
    51.             </h2>  
    52.             <div class="padding10">  
    53.                 <table cellspacing="0" border="0" cellpadding="8" style="width: 90%">  
    54.                     <tr>  
    55.                         <td>  
    56.                             <asp:DataList ID="DataList_Lobbies" CellSpacing="3" Width="400" RepeatColumns="2"  
    57.                                 runat="server">  
    58.                                 <ItemTemplate>  
    59.                                     <asp:HyperLink ID="lnkLobby" runat="server">    
    60.                                                             <nobr><img src="images/home.gif" width="49" height="49" border="0" align="middle"><%#DataBinder.Eval(Container.DataItem, "Name")%></nobr>    
    61.                                     </asp:HyperLink>  
    62.                                     <br />  
    63.                                     (  
    64.                                     <asp:Label ID="lblOnlineChater" runat="server"></asp:Label>  
    65.                                     chatting)  
    66.                                 </ItemTemplate>  
    67.                             </asp:DataList>  
    68.                             <asp:Literal ID="Literal1" runat="server" />  
    69.                         </td>  
    70.                         <td>  
    71.                             <img alt="" src="images/cutechat_picture.jpg" height="180" />  
    72.                         </td>  
    73.                     </tr>  
    74.                 </table>  
    75.             </div>  
    76.         </div>  
    77.     </form>  
    78. </body>  
    79. </html>  
     

    Regards,

     

    Ken 

View Complete Thread