Site Search:
Sign in | Join | Help
4Penny.net

ASP.NET

Notes, Tricks and Tips on ASP.NET Coding

How to add a tool tip to an ASP.NET Datagrid

Very simple. Here is the code

     Protected Sub Grid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles Grid1.ItemDataBound
        If Not e.Item.DataItem Is Nothing Then
            Dim intBalToAlloc As Int64
            Dim intNoHoldQty As Int64


            Dim strTable As String
            intBalToAlloc = DataBinder.Eval(e.Item.DataItem, "balToAlloc").ToString
            intNoHoldQty = DataBinder.Eval(e.Item.DataItem, "intSuborderQtyRemainingNoHolds").ToString


            strTable = "Balance to Allocate:" & intBalToAlloc & vbCrLf
            strTable += "NoHold Qty Remaining: " & intNoHoldQty & vbCrLf
            e.Item.Cells(8).ToolTip = strTable
            e.Item.Cells(9).ToolTip = strTable
            e.Item.Cells(10).ToolTip = strTable
            e.Item.Cells(11).ToolTip = strTable


        End If
    End Sub

Comments

No Comments

About Steve Gray

Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.