SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member PaulHobson's Avatar
    Join Date
    Jun 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Accessing asp:HyperLinkField Text Property On RowDataBind

    Hey All,

    I'm hoping I can get some help to a problem I'm having. I'm trying to access the Data text Field value of a HyperLinkField inside of a GridView Control during the databind event. Normally, I could access any cell's value with some syntax along the lines the following in the RowDataBind function:

    myVarText = e.Row.Cells(2).Text

    But this doesn't work when trying to access the value of the hyperlinkfield. All that's returned is an empty string. If somebody could help point me in the right direction, I would appreciate it.

    Thanks!






    B

  2. #2
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Code Csharp:
    HyperLink hlink = (HyperLink)e.Row.FindControl("hyperlink1").Text

  3. #3
    SitePoint Member PaulHobson's Avatar
    Join Date
    Jun 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks USPatriot,

    This worked out for me.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •