This is a migrated thread and some comments may be shown as answers.

RowCount method

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rohit
Top achievements
Rank 1
rohit asked on 12 Jan 2011, 03:31 PM
I want to use similar code in my RADGRID.
How to use it in RADGRID, since radgrid dont have some methods which was mention in my code.

Private Sub save__details()
        Dim S As Integer
        For S = 0 To datagridgridview1.RowCount - 1
            If CStr(datagridgridview1.Item(0, S).Value()) <> "" Then
                'payment details
                updateRecord("insert into table1 (code)" & _
                  " values('" & CStr(datagridgridview1.Item(0, S).Value()) & "' )")
            End If
        Next
        'loop all the record until end using next.
    End Sub

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Jan 2011, 09:02 AM
Hello Rohit,

Here is a sample code which shows how to loops through each record in RadGrid access the cell vaue.

VB.NET:
Private Sub save__details()
        For Each item As GridDataItem In RadGrid1.Items
            If item.Cells(2).Text <> "&nbsp;" Then
            '  updateRecord
            End If
             
            'or you can access the cell using its column UniqueName
                     
            If item.Cells("UniqueName").Text <> "&nbsp;" Then
            '  updateRecord
            End If
        Next
    End Sub

Also please refer the followimg documentation  for more details on accessinf cells and rows.
Accessing cells and rows

Thanks,
Princy.
Tags
Grid
Asked by
rohit
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or