如何使用在线图像向所有在线用户显示 [英] How to show all online users with the online image

查看:104
本文介绍了如何使用在线图像向所有在线用户显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在使用listview控件显示所有在线用户,我必须在lstview中显示图像以显示用户在线

I am using a listview control to show all online user now i have to give show a image in that lstview to show a user is online

推荐答案

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://stackoverflow.com/questions/459729/如何在Android中查看列表中的图像列表 [
Hi These links may help you
Extended ListView[^]
http://stackoverflow.com/questions/459729/how-to-display-list-of-images-in-listview-in-android[^]


这篇关于如何使用在线图像向所有在线用户显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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