Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > HyperLinkColumn Link Value at ItemCreated

Reply
Thread Tools

HyperLinkColumn Link Value at ItemCreated

 
 
Dude
Guest
Posts: n/a
 
      08-04-2004
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
 
Reply With Quote
 
 
 
 
Thomas Dodds
Guest
Posts: n/a
 
      08-04-2004
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 ...


"Dude" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid and ItemCreated and Pager Binny ASP .Net 2 12-10-2003 06:38 PM
Override Link Style for Hyperlinkcolumn class SStory ASP .Net 3 10-30-2003 05:15 PM
DataList's ItemCreated event Hardy Wang ASP .Net 3 10-27-2003 09:39 PM
Re: getting column value in ItemCreated datagrid event Learning SQL Server ASP .Net 0 08-12-2003 01:38 PM
Why dropdown list created in ItemCreated can't selected lucy ASP .Net 0 08-05-2003 09:12 PM



Advertisments