2013-04-30 43 views
0

我有一個DataGridView,其中有兩種類型的單元格,背景顏色不同(紅色/綠色)。 我想爲此DataGridView設置一個ContextMenu,但我希望它對於紅色單元格和綠色單元格不同。有沒有辦法呢?如何爲DataGridView中的不同單元格設置不同的ContextMenu

而作爲第二個問題,是否有方法爲DataGridViewCells指定ToolTip,並且與紅色/綠色單元有所不同?

回答

0

解決,我注意到,我不僅可以在DataGridView屬性添加的ContextMenuStrip,而且當我在使用rowforeach row,然後foreachcell得到確切的細胞和設置的ContextMenuStrip的確切細胞。

0

添加工具提示在網格視圖 -

asp:TemplateField HeaderText="Comments" SortExpression="short_comment"> 
    <ItemTemplate> 
     <asp:Label ID="Label1" runat="server" Text='<%# Bind("short_comment") %>' ToolTip ='<%# Bind("longer_comment") %>'></asp:Label> 
    </ItemTemplate> 
</asp:TemplateField> 
相關問題