且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用在线图像向所有在线用户显示

更新时间:2023-12-02 14:00:04

ListView ItemTemplate 并将Image 控件的ImageUrl 绑定到一个表明用户是否在线的字段:

Just edit the ItemTemplate of the ListView and bind the ImageUrl of an Image control to a field that says if the user is online or not:

<itemtemplate>
            <tr>
                <td>
                    <asp:image id="isOnlineImage" runat="server" imageurl="<%# ((bool)Eval("IsOnline")) ?"online.png":"offline.png" %>" />
                </td>
              <td>
                    <asp:label id="UserNameLabel" runat="server" text="<%# Eval("UserName") %>"  />
                </td>
               
            </tr>
        </itemtemplate>



在该代码中,我假设您有一个名为IsOnline的字段,以及两个图像online.pngoffline.png.

您可以从中获得适合您的逻辑的想法.

希望对您有所帮助.



In that code I am assuming you have a field called IsOnline, and two images online.png and offline.png.

You can get the idea from that an adapt it to your logic.

hope it helps.


您可以参考此链接


http://forums.asp.net/t/1292817.aspx/1 [ ^ ]
You can refer to this link


http://forums.asp.net/t/1292817.aspx/1[^]


嗨 这些链接可能对您有帮助
扩展ListView [ http://***.com/questions/459729/如何在Android中查看列表中的图像列表 [
Hi These links may help you
Extended ListView[^]
http://***.com/questions/459729/how-to-display-list-of-images-in-listview-in-android[^]