Results 1 to 6 of 6

Thread: [Resolved] GridView selection problem

Threaded View

  1. #1

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

    [Resolved] GridView selection problem

    I am selecting data from 2 cells in my GridView. See code blelow:

    The value from Cell(0) get selected Ok, get error on Cell(5), last line in code.

    Error is:
    Conversion from string "" to type 'Integer' is not valid.

    Code:
    Dim index As Integer = Convert.ToInt32(e.CommandArgument)
                Dim mySelectedRow As GridViewRow = GridView2.Rows(index)
                Dim mySelectedCell As TableCell
    
                mySelectedCell = mySelectedRow.Cells(0)
                Dim mySelectedDate As DateTime = CDate(mySelectedCell.Text) & " 00:00:00"
    
                mySelectedCell = mySelectedRow.Cells(5)
                Dim mySelectedNote As String = ToString(mySelectedCell.Text)
    If I change my code to this:

    Code:
    Dim SelectedNote As String = mySelectedCell.Text.ToString
    I do not get an error, but the value for "SelectedNote" is blank. Could this be due to the field being defined as a Button Field?



    Cell 0: 6/30/2008
    Cell 1: 5101
    Cell 2: Y
    Cell 3: 697.66
    Cell 4: TN
    Cell 5: 1.5" lift 1/1 68+92-114+37 1

    Fields in cells 0 - 4 are bound fields
    Field 5 is a button field (click able)
    Last edited by snufse; Jul 15th, 2008 at 08:55 AM.

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