2013-08-02 33 views
0

我一直在做一個包含類別和項目的項目,我想要的是我想更改項目的前景,以便其他人可以輕鬆識別該項目,除此之外已申請斜體它工作得很好,但我怎樣可以申請前景色和字體大小.....所以我需要幫助的文字...數據集中數據的顏色變化

for (int iRow = 0; iRow < dsDetails.Tables[0].Rows.Count; iRow++) 
    { 
     DataRow[] drCatFilter; 
     // Get the dish item name for the current mapping 
     drCatFilter = dsCommon.Tables[0].Select("ID = '" + dsDetails.Tables[0].Rows[iRow]["catmappingid"].ToString() + "'"); 
     // Create the dish item 
     item = new MenuItem(); 
     item.Value = dsDetails.Tables[0].Rows[iRow]["id"].ToString(); 
     item.Text = ("<i>"+dsDetails.Tables[0].Rows[iRow]["name"].ToString()+"</i>"; 

     ![As the image shows category(food,beverages etc.) and items(Dosa,beer etc) i need to change the forecolor of itemms][1] 

    [1]: http://i.stack.imgur.com/3ljsp.png 

回答

0

你有沒有嘗試設置「前景」和MenuItem的「FontSize」屬性?

item = new MenuItem(); 
    item.Value = dsDetails.Tables[0].Rows[iRow]["id"].ToString(); 
    item.Text = ("<i>"+dsDetails.Tables[0].Rows[iRow]["name"].ToString()+"</i>"; 
    item.Foreground = "something" 
    item.Fontsize = "something" 

還是我理解你的問題錯了?

+0

它在item.foreground和item.fontsize上顯示錯誤,因爲system.web.UI.webcontrols.menuitems不包含前景定義和擴展方法 – Ashish

相關問題