I have a Gridview that has a timestamp as one of the rows. When I read the data from the database the data is in the format( mm/dd/yyyy hh:mm:ss ). I've figured out how to format the way I want it which is just the ( mm/dd/yyyy ) and droping of the (hh:mm:ss) with the following code:
Dim numrows2 = GridView1.Rows.Count
For i = 0 To numrows2 - 1
Dim acc = Left(GridView1.Rows(i).Cells(0).Text, 10)
GridView1.Rows(i).Cells(0).Text = acc
Next i
The problem is that this gridview has like 5 pages and this will only work for the current page. For instance,
- initial load of the page the 1st page will be formatted correctly
- I click page 3, this code will format page 1, so page 3 won't be formatted
- I click page 1, the code will format page 3
So it's basically formatting the current page, but not the selected page.
I either need to be able to format every row of the gridview everytime, or be able to figure out the page selected and format that page. I don't know how to do either.
Any help would be appreciated.