473,509 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add formatted text to JavaScript function call during ItemDataBound of a Repeater Control.

Hello,

I am taking values from a datatable and formatting them for use in a
JavaScript Function Call.
The end result is a mouse over tool tip.

Here is what I am doing.

I have tried to use a property but it uses the last set value of all.

Private Sub drTasks_ItemDataBound(ByVal sender As Object,
ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs)
Handles
drTasks.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then

Dim ttTitle As String = IIf(Not IsDBNull(e.Item.DataItem("Title")),
e.Item.DataItem("Title"), "")
Dim ttDesc As String = IIf(Not
IsDBNull(e.Item.DataItem("Description")), e.Item.DataItem("Description"),
"")
Dim ttDateStart As String = IIf(Not
IsDBNull(e.Item.DataItem("DateStart")),
CDate(e.Item.DataItem("DateStart")).ToShortDateStr ing, "")
Dim ttDateDue As String = IIf(Not
IsDBNull(e.Item.DataItem("DateDue")),
CDate(e.Item.DataItem("DateDue")).ToShortDateStrin g, "")

Dim ToolTip As New System.Text.StringBuilder

' First I build the text
ToolTip.Append("Title: " & ttTitle & "<br /><br />")
If ttDesc <> "" Then ToolTip.Append(ttDesc & "<br /><br />")
ToolTip.Append("Start Date: " & ttDateStart & "<br />Due Date: " &
ttDateDue)

' Once I have finished I push the value into the description.
e.Item.DataItem("Description") = ToolTip

End If
End Sub

On the HTML side I use the following in the <ItemTemplate> of the Repeater
Control.
...<td.... onMouseover="ddrivetip('<%#DataBinder.Eval(Contain er,
"DataItem.Description")%>','#284461', 300)">...

Any Iteas?

Thanks,
Bryan

Nov 18 '05 #1
1 2238
For each itemBound clear the stringbuilder and append new description.Now u r
not clearing stringbuilder for each dataitem.

"Bryan" wrote:
Hello,

I am taking values from a datatable and formatting them for use in a
JavaScript Function Call.
The end result is a mouse over tool tip.

Here is what I am doing.

I have tried to use a property but it uses the last set value of all.

Private Sub drTasks_ItemDataBound(ByVal sender As Object,
ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs)
Handles
drTasks.ItemDataBound
If e.Item.ItemType = ListItemType.Item Then

Dim ttTitle As String = IIf(Not IsDBNull(e.Item.DataItem("Title")),
e.Item.DataItem("Title"), "")
Dim ttDesc As String = IIf(Not
IsDBNull(e.Item.DataItem("Description")), e.Item.DataItem("Description"),
"")
Dim ttDateStart As String = IIf(Not
IsDBNull(e.Item.DataItem("DateStart")),
CDate(e.Item.DataItem("DateStart")).ToShortDateStr ing, "")
Dim ttDateDue As String = IIf(Not
IsDBNull(e.Item.DataItem("DateDue")),
CDate(e.Item.DataItem("DateDue")).ToShortDateStrin g, "")

Dim ToolTip As New System.Text.StringBuilder

' First I build the text
ToolTip.Append("Title: " & ttTitle & "<br /><br />")
If ttDesc <> "" Then ToolTip.Append(ttDesc & "<br /><br />")
ToolTip.Append("Start Date: " & ttDateStart & "<br />Due Date: " &
ttDateDue)

' Once I have finished I push the value into the description.
e.Item.DataItem("Description") = ToolTip

End If
End Sub

On the HTML side I use the following in the <ItemTemplate> of the Repeater
Control.
...<td.... onMouseover="ddrivetip('<%#DataBinder.Eval(Contain er,
"DataItem.Description")%>','#284461', 300)">...

Any Iteas?

Thanks,
Bryan

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2324
by: Ben R. | last post by:
I've got a repeater that's bound to a datareader and I'd like to conditionally modify the text that is being outputted. Previously, I've done this by assigning a name to attribute to the...
2
2362
by: ASP Yaboh | last post by:
I have a Repeater control bound to a DataSet that creates a table with 6 columns. The text displayed in one of the columns may need to be set to grey instead of black. The DataSet is held and...
4
6185
by: Adam Boczek | last post by:
I've a dropdownlist control to change language on my page. Because of page lifetime, I have to set all my labels, texts etc. from ResourceManager in prerender handler to be sure that culture change...
14
2299
by: Joe | last post by:
Hello All: I am trying to dynamically populate a web page with literal content and controls (textboxes and checkboxes (and eventually two buttons - the buttons do not appear in the code yet). I...
1
3174
by: Lukas Kurka | last post by:
Hi, I have a asp:repeater and inside it I have asp:button control. How can I add javascript onclick function (and also another) to the button. Thank you for your help
1
1285
by: sck10 | last post by:
Hello, I am inserting the values for radio buttons on a form into a database. There are 25 questions with 4 possible answers (see below). Is it possible to pragmatically build the radio button...
1
1026
by: Loading name... | last post by:
hey asp.net 2.0 I have a ItemDataBound event in my repeater control. My problem is that I don't know how to access the data in the ItemDataBound control. Lets say the datasource has a field...
2
2366
by: John Kotuby | last post by:
Hi all, Thanks in advance for any suggestions... I am using a repeater to display the contents of a DataTable which is bound to it. All the rows in the table are being displayed. In the...
8
1969
by: Andy B | last post by:
I have the object property StockContract.Dictionary which is a dictionary collection of <string, stringkey/value pairs. I need to be able to retreive the keys and their values and display them on a...
0
7233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7135
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7410
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.