轉帖|使用教程|編輯:龔雪|2017-01-22 16:57:22.000|閱讀 679 次
概述:
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
如何根據列值不同設置不同圖標
<dx:ASPxListBox ID="listBIViews" AutoPostBack="true" runat="server" Width="100%" EncodeHtml="false" Border-BorderWidth="0" ItemStyle-SelectedStyle-BackColor="#FFAE30" ItemStyle-HoverStyle-BackColor="#FFEE62" ondatabound="listBIViews_DataBound" onselectedindexchanged="listBIViews_SelectedIndexChanged" > <Items> <dx:ListEditItem ImageUrl="~/images/summary.png" Text="Cashout(10)" /> </Items> </dx:ASPxListBox>
不同條目顯示:圖標——跟著一段標題性文字
protected void listBIViews_DataBound(object sender, EventArgs e) { foreach (ListEditItem li in (sender as ASPxListBox).Items) { string fullText=li.Text; string shortText=""; if (li.Text.Length > 30) { shortText = li.Text.Substring(0, 10) + "... (10)"; } else { shortText = li.Text + " (10)"; } String text = String.Format("<div title='{0}'>{1}</div>", fullText,shortText); li.Text = text; //li.ImageUrl = "~/images/view.png";//根據情況顯示不同的view圖標 } }
想要了解更多DevExpress使用技巧?海量視頻課程以及最專業的DevExpress培訓盡在
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn