0

BoundColumn にツール ヒントを追加する方法はありますか? これは私のコードです....

    <asp:BoundColumn DataField="PersonName" SortExpression="PersonName" HeaderText="Name">
        <HeaderStyle HorizontalAlign="Center" Width="10%" VerticalAlign="Top"></HeaderStyle>
        <ItemStyle HorizontalAlign="Center" VerticalAlign="Top"></ItemStyle>
    </asp:BoundColumn>

以前はテーブルセルを使用していましたが、バインドされた列に切り替えることにしました。その際、ツールチップはバインドされた列の属性ではないことに気付きました。ツールチップが必要です。

4

1 に答える 1

2

これは実際にはDataGridコントロールであり、ヘッダー セルにツールチップを表示したいと考えています。使用できますItemDataBound

Protected Sub SortableDataGrid_ItemDataBound(sender As Object, e As DataGridItemEventArgs) Handles Grid0.RowDataBound
    Select Case e.Item.ItemType
        Case ListItemType.Header
            'presuming it's the first column:
            e.Item.Cells(0).ToolTip = "Your tooltip for this header cell"
    End Select
End Sub

それがの場合GridView、コードは似ています:

Protected Sub SortableGridView_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles Grid0.RowDataBound
    Select Case e.Row.RowType
        Case DataControlRowType.Header
            'presuming it's the first column:
            e.Row.Cells(0).ToolTip = "Your tooltip for this header cell"
    End Select
End Sub
于 2015-09-30T13:14:36.307 に答える