Results 1 to 7 of 7

Thread: [Resolved] How to get value of gridview buttonfield (linkbutton)

Threaded View

  1. #1

    Thread Starter
    Fanatic Member snufse's Avatar
    Join Date
    Jul 2004
    Location
    Jupiter, FL
    Posts
    912

    [Resolved] How to get value of gridview buttonfield (linkbutton)

    I have a gridview and I am able to get cell values for bound fields like this:


    Code:
    If e.CommandName = "description" Then
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)
                Dim mySelectedRow As GridViewRow
                mySelectedRow = GridView1.Rows(index)
                Dim mySelectedCell As TableCell
                mySelectedCell = mySelectedRow.Cells(3)
                Dim jobtext As String
                jobtext = mySelectedCell.Text
    End If

    Now I need to get the value for a Button Field (header column name is "description") and not sure how to do this. Here is the code I have:


    Code:
    Dim index = Convert.ToInt32(e.CommandArgument)
    Dim mySelectedRow As GridViewRow = GridView1.Rows(index)
    Dim myButtonField As LinkButton = mySelectedRow.FindControl("description")
    Dim jobtext As String = myButtonField.Text.ToString
    Get error (last line of code): Object reference not set to an instance of an object.

    Can somebody help please. Thank you.
    Last edited by snufse; Jul 15th, 2008 at 02:16 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width