Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 How would I write this...

Author  Topic 

JJ297
Aged Yak Warrior

940 Posts

Posted - 2009-01-15 : 14:08:44
I am using Dec07 field as a tool tip

I want to use Dec07int and Dec07 tcnt as fields to supply the data for the tool tip.

Here's the table in the db

Sort Reg Dec07 Dec 07int Dec 07tcnt
1 NAT Null Null 49

This code will put a 0 in the Dec07 field if it is NULL and then add some wording to the tooltip

Dim b As Integer 'tooltip
b = 2 'column to display tooltip

Dim bb as Integer
bb = 4 'bound column to get tooltip data from

If e.Row.Cells(b).Text = " " Then
e.Row.Cells(b).Text = "0"
e.Row.Cells(b).ToolTip = "internet=" & "" & e.Row.Cells(bb).Text & " - " & " " & "total=" & "" & e.Row.Cells(cc).Text
e.Row.Cells(b).Style("cursor") = "hand"

How can I add to this to get a 0 to show up in the tooltip where the wording would be internet = 0 since Dec07int is Null?

I know I need another if statement like

if e.row.cells(bb).text = " " then
e.row.cells(b).tooltip = "internet - 0"

I just can't get it to tie in with the code above can someone help me?

Ohmslaw
Starting Member

11 Posts

Posted - 2009-01-15 : 14:44:24
you can create a function to evauate the colunm and return a value:
Private Function CheckColumn(ByVal parm As String) As String
Dim ret As String
If parm = " " Then ret = "0" Else ret = parm
Return ret
End Function

This can be used to evaluate any text you send to it and return a value.
example (e.Row.Cells(b).ToolTip = "internet=" & "" & CheckColumn(e.Row.Cells(bb).Text) & "so on...")



Ohms...
Go to Top of Page

JJ297
Aged Yak Warrior

940 Posts

Posted - 2009-01-15 : 15:06:29
Thanks for your response but I figured it out. Will use a function like you suggested next time much easier. Here's my results.


If e.Row.Cells(b).Text = " " Or e.Row.Cells(c).Text = " " Then
e.Row.Cells(b).Text = "0"
e.Row.Cells(b).ToolTip = "Internet=" & "" & e.Row.Cells(bb).Text & " - " & " " & "total=" & "" & e.Row.Cells(cc).Text
e.Row.Cells(b).Style("cursor") = "hand"
End If
If e.Row.Cells(bb).Text = " " Then
e.Row.Cells(b).ToolTip = "Internet=0" & " - " & "total=" & "" & e.Row.Cells(cc).Text
e.Row.Cells(b).Style("cursor") = "hand"

End If
Go to Top of Page
   

- Advertisement -