HyperLinkColumn Link Value at ItemCreated

Discussion in 'ASP .Net Datagrid Control' started by Dude, Aug 4, 2004.

  1. Dude

    Dude Guest

    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
     
    Dude, Aug 4, 2004
    #1
    1. Advertising

  2. Dude

    Thomas Dodds Guest

    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" <> wrote in message
    news:...
    > 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
     
    Thomas Dodds, Aug 4, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lucy
    Replies:
    0
    Views:
    316
  2. Learning SQL Server

    Re: getting column value in ItemCreated datagrid event

    Learning SQL Server, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    555
    Learning SQL Server
    Aug 12, 2003
  3. SStory
    Replies:
    3
    Views:
    2,440
    SStory
    Oct 30, 2003
  4. Hardy Wang

    DataList's ItemCreated event

    Hardy Wang, Oct 27, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    3,600
    Hardy Wang
    Oct 27, 2003
  5. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    903
    Kevin Spencer
    May 17, 2005
Loading...

Share This Page