Tag云图

<asp:Repeater ID="Repeater1" runat="server">
                                <ItemTemplate> <a href=#><span style="font-size: <%# getFontSize(Eval("CountValue"),10,48) %>px"><%# Eval("TagName") %></span></a> </ItemTemplate>
                            </asp:Repeater>
 
 
 public int Max = 0;
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = TagDBAdapter.GetMyTagList(UserID);
            DataTable dt = ds.Tables[0];
            int.TryParse(dt.Compute("Max(CountValue)", "").ToString(),out Max );
            Repeater1.DataSource = dt;
            Repeater1.DataBind();
        }
    }
    public int getFontSize(object o, int MinFontSize, int MaxFontSize)
    {
        if (o != null && Max!=0)
        {
            int i = 0;
            int.TryParse(o.ToString(),out i);
            return ((MaxFontSize - MinFontSize) / Max * i + MinFontSize);
        }
        return MinFontSize;
    }
posted @ 2008-02-21 10:52  Leepy  阅读(284)  评论(0)    收藏  举报