Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub gridfill()
        ds = employee.Getsearchemp(Trim(txtsearch.Text))
        Gridsearch.RowCount = 0
        For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
            Gridsearch.RowCount += 1
            Gridsearch(Gridsearch.RowCount, 1).CellValue = ds.Tables(0).Rows(i)("regionname")
            Gridsearch(Gridsearch.RowCount, 2).CellValue = ds.Tables(0).Rows(i)("unitname")
            Gridsearch(Gridsearch.RowCount, 3).CellValue = ds.Tables(0).Rows(i)("first_name")
            Gridsearch(Gridsearch.RowCount, 4).CellValue = ds.Tables(0).Rows(i)("fathername")
            Gridsearch(Gridsearch.RowCount, 5).CellValue = ds.Tables(0).Rows(i)("DOB")
            Gridsearch(Gridsearch.RowCount, 6).CellValue = ds.Tables(0).Rows(i)("designationname")
            Gridsearch(Gridsearch.RowCount, 7).CellValue = ds.Tables(0).Rows(i)("probation_date")
            Gridsearch(Gridsearch.RowCount, 8).CellValue = ds.Tables(0).Rows(i)("DOJ")
            Gridsearch(Gridsearch.RowCount, 9).CellValue = ds.Tables(0).Rows(i)("Resignation Date")
        Next
    End Sub



i'm using this and get error
row count' is not a member of 'system.web.ui.webcontrols.gridview
thanks in advance
Posted

1 solution

you can bind dataset directly to a gridview
VB
Gridsearch.DataSource = ds
    Gridsearch.DataBind()

if you need to get row count, try Gridsearch.Rows.Count property
 
Share this answer
 
v2
Comments
neeraj_ 3-Jan-15 2:24am    
sir thank you very much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900