HyperLinkColumn Link Value at ItemCreated

D

Dude

I would like to format the url based on its value. How do I get the
value in my ItemCreated handler?

Sub DataGridItemCreatedHandler(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
Select Case e.Item.ItemType
Case ListItemType.AlternatingItem, ListItemType.Item 'Check the
Row Type
If (url for this row) = xxx Then
Dim hl As HyperLinkColumn = CType(dgMain.Columns(2),
HyperLinkColumn)
hl.DataNavigateUrlFormatString = ""
End If
End Select
End Sub
 
T

Thomas Dodds

I did this -- this morning!

Private Sub dgResults_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgResults.ItemCreated
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType =
ListItemType.Item Then
Dim hlCol1 As HyperLinkColumn = CType(dgResults.Columns(1),
HyperLinkColumn)
Dim hlCol2 As HyperLinkColumn = CType(dgResults.Columns(3),
HyperLinkColumn)

hlCol1.DataNavigateUrlFormatString = "javascript:doSelectPopup({0},"
& intContID & ");"
hlCol2.DataNavigateUrlFormatString = "javascript:doViewPopup({0}," &
intContID & ");"
End If
End Sub

I wanted to call a javascript using a databound param and a class scope var
param ... it works ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top